Tiki uses Smarty (TPL) template files to control the presentation (that is, the display) of each page of your Tiki website. The Smarty template engine allows you to separate the presentation (look & feel) from the logic (programming).
Tip
Note
Tip
Any template files that you modify should be placed in a custom theme folder — do not modify the template files in the ../templates/*.tpl folder. See Saving Your Theme for more information.
Note
Finding the Right Template
So, how do you figure out which of the more than 800 template (TPL) files you need to edit? Some template files have a direct, one-to-one correlation with a PHP file. This means you simply need to look a the browser's address bar to determine the correct template.
{TIP()}The Template Map provides a detailed listing of which templates include others.{TIP}
For example, the template used for the site registration page (tiki-register.php) is tiki-register.tpl.
For other pages it is not nearly that easy. Some pages, such as the event calendar (tiki-calendar.php) are actually made up of five (or more!) different templates. Luckily, there is an option to help you find which templates are used.
When you enable the Smarty template usage indicator option on the Miscellaneous tab of the Admin: Look & Feel page, Tiki will add comments to the generated HTML files that identify the beginning and ending of each template (TPL) file.
When you enable the Smarty template usage indicator option on the Miscellaneous tab of the Admin: Look & Feel page, Tiki will add comments to the generated HTML files that identify the beginning and ending of each template (TPL) file.
When you enable the Smarty template usage indicator option on the Miscellaneous tab of the Admin: Look & Feel page, Tiki will add comments to the generated HTML files that identify the beginning and ending of each template (TPL) file.
By viewing the HTML source of a generated Tiki page, you can determine which template (TPL) is responsible for what content, as shown below:
Warning
Including Wiki Syntax
The Tiki template (TPL) files are created with the Smarty template engine. Smarty templates use a mixture of XHTML and PHP — not Tiki's wiki syntax. For example, to bold text in a Smarty TPL template file, use:
<strong>text</strong>
not:
__text__
However, there may be places that you need to use some wiki syntax. For example, you may want to include a wiki heading in template, use:
{wiki} !Level 1 Heading ... {/wiki}
Using modules and plugins
To include a Tiki module or plugin in a Smarty template (TPL) file, you must use the {literal} tag, in addition to the {wiki} tag, as shown previously.
For example, if you wanted to include the Tiki search module at the bottom of every web page on your Tiki site, you could add the following to the footer.tpl template:
{wiki} {literal} {MODULE(module=>search, show_object_filter=y, advanced_search=y) /} {/literal} {/wiki}
Tip
{module module=search show_object_filter=y advanced_search=y}
See Using Modules for additional information about Tiki modules.
When adding plugins, you can use the {wikiplugin} tag to avoid having to use the {wiki} and {literal} tags:
{wikiplugin _name="NAME OF PLUGIN" PARAMETER="VALUE" PARAMETER="VALUE"}{/wikiplugin}