Loading...
 
Skip to main content

History: Template Overview

Preview of version: 8

(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


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 PHP Layers) and sometimes the search form.)

(As of TikiWiki 2, there is no need to edit the error.tpl file (which formerly was identical to tiki.tpl except for having error-specific main content).

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.

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 TikiWiki via admin configuration, which tends to make template editing unnecessary.

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, generally speaking, 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. However, TikiWiki release 2 is in a transition period and the bundled themes include older ones that use an old-school table-based layout method, and new themes that use the *litecss table-free layout method. Choose as a model (and use the files of) whichever is closest to the target design (also see Themes_for_TW2 ).

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 synch 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

Layout

Subscribe to Tiki Newsletters!

Delivered fresh to your email inbox!
Newsletter subscribe icon
Don't miss major announcements and other big news!
Contribute to Tiki

Site Config