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