Fullscreen
Loading...
 
[Show/Hide Left Column]
[Show/Hide Right Column]

Print
  • World
    • No language is assigned to this page.

Theme-specific templates

Sometimes it's necessary, or at least easier, to use a custom template (.tpl file) in a theme than to try to get the desired appearance or element position using the default templates and CSS. This method isn't encouraged, because any template customizing makes updating the site harder.

One example of theme-specific variation in template files is how the site-header area of the page is done in Strasa, compared to the other bundled themes. The design has the menu at the top of the page, above the site title and so on, and the log-in form at the bottom of the site header, and so is the opposite of the normal arrangement. We tried to use CSS's relative and absolute positioning to move the menu to that position, but this failed in IE6 and IE7, for various reasons. (For example, IE6 needs the parent div to have its height specified in order to have a child positioned relative to the parent's bottom edge. But giving the Tiki site header a definite height is a bad idea because we want it to accomodate logos of various sizes, custom content, and so on, so it needs to be flexible.)

The solution is to make tiki-site_header.tpl simply a wrapper that contains include files for the header components:

Standard tiki-site_header.tpl Strasa's tiki-site_header.tpl
missing page for plugin INCLUDE
missing page for plugin INCLUDE
missing page for plugin INCLUDE
missing page for plugin INCLUDE
missing page for plugin INCLUDE
missing page for plugin INCLUDE
missing page for plugin INCLUDE


So Strasa's tiki-site_header.tpl lists the components in a new order (tiki-topbar.tpl at the top), which places them on the page in that order. The actual code in the included files doesn't get modified for the theme; it just gets relocated on the page, so there are no theme-specific code variations to keep in sync with the core code.

Sometimes a template-with-code does get modified for a theme. If this path is chosen, then be sure the modifications are clearly commented, documented and so on, so that when the default files are edited as Tiki advances (and they will be), the theme's modified files can be updated accordingly and so stay compatible with the new Tiki version.

Subscribe to Tiki Newsletters! [toggle]

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

Theme: Fivealive [toggle]

Shoutbox

luci, 09:13 GMT, Mon 09 of Dec, 2013: logo updated with ®. please do ctrl+F5 refresh...
chibaguy, 06:31 GMT, Thu 16 of May, 2013: Veronica, that star has been eclipsed many times, with Tiki 11.o now soon to rise. ;-)
veronicamarsh, 08:33 GMT, Sun 12 of May, 2013: tikiwiki 2.0 is the star of this weekend. Just follow as we add it to SM dev.
chibaguy, 02:57 GMT, Thu 04 of Oct, 2012: This is a late reply, but, for the record, the Milkyway theme (following the original design) doesn't have a search form in the top bar. You can put one at the top of a side column, etc. instead.
andi6803, 12:20 GMT, Tue 18 of Oct, 2011: I use tiki 6v4 with the Milkyway theme. But it's not possible to switch on the search bar at the top bar. With other themes it works.