Now, updated for Tiki 8!
Now accepting new user registrations! Become a contributor.
| More
Join Print Print multiple pages Convert to PDF

Modifying Templates


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).
TipTip:
New to Tiki? See "Editing Templates"(external link) in Tiki for Dummies Smarties for basic information.

NoteNote:
Do not confuse these Smarty (TPL) template files with the Tiki content templates.

TipTip:
For complete information on using Smarty, see http://www.smarty.net/(external link).


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.
NoteNote:
Creating modified template files as part of your custom theme may make it more difficult to upgrade your Tiki. You will need to re-apply your customizations to the new set of templates each time you upgrade.



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.
TipTip:
The Template Map provides a detailed listing of which templates include others.


For example, the template used for the site registration page (tiki-register.php) is tiki-register.tpl.
PHP and TPL file
One template per page.


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.


7.x
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.
Admin: Look and Feel page
Enabling the template indicator.


6.x
When you enable the Smarty template usage indicator option on the Theme 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.
Admin: Look and Feel page
Enabling the template indicator.




By viewing the HTML source of a generated Tiki page, you can determine which template (TPL) is responsible for what content, as shown below:
HTML source
Enabling the template indicator


WarningWarning:
Do not use the Smarty Template usage indicator on a "live" site. Tiki will include the template comments in all generated content, including messages and email, and these comments will be visible to all site users.



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:
Adding the Search module to a template
{wiki}
 {literal}
  {MODULE(module=>search, show_object_filter=y, advanced_search=y) /}
 {/literal}
{/wiki}


TipTip:
You could also use the simplified version of the module: {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:
Adding a wiki plugin to a template
{wikiplugin _name="NAME OF PLUGIN" PARAMTER="VALUE" PARAMTER="VALUE"}{/wikiplugin}


Contributors to this page: Rick Sapir .
Page last modified on Thursday, June 16, 2011 09:51:49am EDT by Rick Sapir.
The content on this page is licensed under the terms of the Copyright Information.

Buy the Books

Tiki Essentials & Tiki for Smarties -- Buy the Books.
Available from Amazon, LuLu, and more as paperback or ebook...

What do you think?

What do you think of this project?



Anti-Bot verification code image Try another code



View Results
(Votes: 20)

"..This is the only Tiki site that explained things enough that I could follow and understand. Thank you!"

Is Essentials helpful?

Essential Readers



Advertising



Powered by Tiki Wiki CMS Groupware
Creative Commons Copyright. Some rights reserved.
Tiki Essentials (this site) is © 2011-2012 by Rick Sapir, published by KeyContent.org, and is licensed
under a Creative Commons Attribution-Share Alike 3.0 United States License. Some rights reserved. Privacy Policy.
Permissions beyond the scope of this license may be available at http://twessentials.keycontent.org/Copyright Information.
Questions, comments, or concerns about this site or the guide? Let me know.
New to Tiki? Try Tiki for Dummies Smarties: A beginner's guide to using Tiki Wiki CMS Groupware.


Feedback Form
Feedback Analytics