History: Template Overview
Preview of version: 6
(from Style and Themes - to be updated)
How to modify .tpl files
About Smarty
The .tpl (template) files are written using the Smarty template language, which has its own syntax, etc. Smarty is mainly used for defining environment variables and the logic that follows (like who to show what when how). See smarty.php.net.
You can modify just the html in .tpl files though, and comment out some of the logic for features you never use. Be careful to keep backups though because a smarty error in a main template is a good way to crash your site.
The Template Tree
The hundreds of templates are called in a specific order within the code, so you need to know what is a parent of what, particularly for the main few that dominate the layout of the site.
CMS Templates (Frequently Modified)
- tiki.tpl: the main template defining the layout which calls:
- header.tpl: the HTML header
- tiki-top_bar.tpl: site identity and navigation bar
- tiki-page_bar.tpl - lower wiki controls
- tiki-bot_bar.tpl: bottom banner links/credits bar
- footer.tpl:
- error.tpl: used to display errors
- the template files with names like tiki-print.tpl are used for printable representation of objects so usually don't need to be changed.
As you can see, you can modify the layout of the whole tiki application by just changing one file or a few files.
Theme Specific Templates
To modify the layout of Tiki in your theme, edit theme-specific copies of default Tiki template files. While CSS editing is used to specify the details of page appearance, it is necessary to edit template files to make major rearrangements of items on the page. One example is to change the normal three-column layout to two or one columns, or to add a module to the top bar.
Wiki Templates (More Advanced)
- tiki-showpage.tpl - main wiki template, upper controls
- tiki-page_bar.tpl - lower controls
Unless there is a special need to emulate an existing theme, the best course is probably to base new theme templates on the default Tiki templates, that is, on templates/tiki.tpl, templates/tiki-top_bar.tpl, and so on.
Overriding templates
The template files for each theme are stored in a directory with the same name as the theme (less the ".css" file type indicator) in the templates/styles directory — for example, templates/styles/screensite.
A theme's files will override any default template file. You just need to put a modified template file in the directory templates/styles/custom_theme_name.
For example, if we want to modify the forum listing in our screensite theme, we'd just place a copy of the file templates/tiki-forums.tpl in templates/styles/screensite/ and then edit the new theme-specific copy of the tiki-forums.tpl file.
Tiki will substitute whatever is in your custom theme directory for the .tpl files in the default directory.
This technique works on files in the subdirectories, too. E.g., to change the application menu in your theme, just copy the file mod-application_menu.tpl from templates/modules/ to templates/styles/custom_theme_name/modules/.