Loading...
 
Skip to main content

History: Template Overview

Preview of version: 10

(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.

Modifying the .tpl files isn't recommended if the site's appearance can be changed using CSS alone; sometimes it is necessary, though, but be sure to be familiar with Smarty syntax and how Tiki uses Smarty files before going this route.

The Template Tree


Tiki's templates are called in a specific order within the code, so it's good to know what is a parent of what, particularly for the main few used for the basic layout of the site.

Templates (most frequently modified)

  • tiki.tpl: the main template defining the layout, which calls:
    • header.tpl: the HTML head section (avoid modifying, if possible)
    • tiki-site_header.tpl: site Look & Feel options and/or menu
    • tiki-top_bar.tpl: possibly menu and search form
    • tiki-bot_bar.tpl: bottom banner links/credits bar


(Whether tiki-site_header.tpl or tiki-top_bar.tpl or both needs to be modified depends on what theme files are used as a starting point for a custom theme. New themes tend to use tiki-site_header.tpl for more Look & Feel components, and reserve tiki-top_bar.tpl for the menu (usually a CSS, or suckerfish, menu) and sometimes the search form.)


Template files with names like tiki-print.tpl usually don't need to be changed.

The layout of the whole Tiki page can be changed by modifying just one file or a few files.

To put Smarty template beginning and end tags in comments in the final page source, as of Tiki 4 there is an option in Admin Features(tiki-admin.php?page=features), under the Developer tab, called "Smarty Template usage indicator". As indicated on that page, "Use only for development, not in production because these warnings are added to emails as well, and visible to the users." You can then check the final page source to see what code is produced by what Smarty template file.


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 may be necessary to edit template files to make major rearrangements of items on the page. But an increasing amount of flexibility is being added to Tiki via admin configuration, which tends to make template editing unnecessary.

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. That is, 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/.

It's recommended that as few template files be customized as possible, and the customizations kept as minimal as possible, in order to keep the maintenance and updating of the files easier. The more extensive the customization, the harder to keep in sync with the functionality of Tiki as it advances.

History

Advanced
Information Version
Mon 15 of Feb, 2016 12:51 GMT-0000 Jean-Marc Libs 17
Mon 15 of Feb, 2016 12:47 GMT-0000 Jean-Marc Libs 16
Wed 19 of Mar, 2014 01:27 GMT-0000 Marc Laporte 15
Sat 27 of Jul, 2013 07:08 GMT-0000 haggis73 changed url and comment to smarty. 14
Wed 30 of Jun, 2010 07:33 GMT-0000 Gary Cunningham-Lee Some updating. 13
Wed 30 of Jun, 2010 06:45 GMT-0000 Gary Cunningham-Lee Changed bold line to heading. 12
Wed 30 of Jun, 2010 06:44 GMT-0000 Gary Cunningham-Lee typo 11
Wed 30 of Jun, 2010 06:43 GMT-0000 Gary Cunningham-Lee Some updating. 10
Tue 27 of Jan, 2009 12:37 GMT-0000 Gary Cunningham-Lee Updating 9
Tue 27 of Jan, 2009 12:34 GMT-0000 Gary Cunningham-Lee Some updating. 8
Wed 08 of Oct, 2008 05:18 GMT-0000 Gary Cunningham-Lee Some updating. 7
Mon 09 of Jun, 2008 15:12 GMT-0000 Oswaldo1965 6
Mon 21 of Apr, 2008 20:24 GMT-0000 mlpvolt 5
Fri 28 of Dec, 2007 20:30 GMT-0000 mlpvolt 4
Mon 20 of Feb, 2006 02:32 GMT-0000 Gary Cunningham-Lee Minor edits. 3
Fri 17 of Feb, 2006 06:56 GMT-0000 System Administrator Content added from doc.tw.o 2
Fri 17 of Feb, 2006 02:41 GMT-0000 system created from structure 1