Template Editor

From FUDforum Wiki
Jump to: navigation, search
Important Symbol IMPORTANT: After making manual modifications to the template(s), be sure to recompile the theme using those templates via the Theme Manager to activate your changes.

The Template Editor admin control panel allows the administrator to customize and change the appearance of their forum in its entirety.

When you access the template editor you are presented with a form that allows you to choose for which theme and language you are editing the templates for.

This control panel offers a web interface to the templates, allowing the administrator to change the templates via their browser. This is generally intended for quick changes and/or fixes, if you intend to do a complete layout redesign we recommend changing the templates (*.tmpl files inside the tmpl directory for each theme) with your text editor of choice.

The template editor shows the administrator a list of all the available templates that make up the various forum pages. clicking on the red link beside each template it will expand the template, showing all the sub-templates that make up this page.

The primary page template has a light purple colour, this template defines how the page and its elements will be constructed. The other sub-templates, which are coloured black define the various page elements that make up the page. Beside some templates who's name may not explain their purpose you can find green explanation text that will tell you the purpose of the template.

If you click on the template, the template's data will be loaded in to a text area allowing you to edit the template. The template's data is mostly comprised of raw HTML with certain template tags representing the dynamic data that will be inserted into the template.

Template language

The following, are the non-HTML template entities that can be found inside the template:

Template code Description
{MSG: msg_key} Reference to a message inside the i18n messages file (for example, for English: thm/default/i18n/en/msg).
{VAR: var_key} A PHP variable (without the $ prefix). For example, {VAR: x} refers to $x and {VAR: _SERVER['REQUEST_URI']} refers to the current URL.
{DEF: var_key} A PHP define.
{DATE: var_key date_format} Print date based on var_key passing the date_format as the date's format to strftime() function.
{VAR-HTML: var_key} PHP variable that will be encoded using htmlspecialchars() function.
{VAR-URL: var_key} PHP variable that will be encoded using urlencode() function.
{VAR-SEO: var_key} Convert PHP variable to a URL bit that can be used for SEO friendly URL's (introduced in FUDforum 3.0.5).
{ALT-VAR: alt_name key1 key2 ...} Colour alternator, it will alternate the colours specified as key# (deprecated, should be removed from all templates).
{FUNC: func(args...)} Call a formatting function.
{TEMPLATE: template_name} Include template with the specified name here.
{TEMPLATE-DATA: var_key} Template's data which is stored in a variable.
Info Symbol NOTE: If you edit the tmpl files manually you will also come across the {REF: template_file_name} tag. This tag tells the template compiler to include the source of the said file when generating the page you are editing. The compiler then will inline the file when it is generating this page.

To save your changes, click on the 'Save Changes' button, this will not only save your changes but also recompile the template putting the changes you've made live. So, that you will be able to see how those changes altered the layout of the page.

If you wish edit to content of the text shown on the page, click on the 'Edit Text Messages', which will allow you to edit all of the text messages used on this page using the Message Editor.

Also see

Personal tools