Blog layout

For Tiki 6, Tiki's blog section has been renovated, with many new features added and revisions made to existing features (see http://dev.tiki.org/Blog revamp). One part of this was to modify the way blog posts are displayed by the template (.tpl) files. The blog post template files (tiki-view_blog.tpl and tiki-view_blog_post.tpl) were edited to replace sections of code with a wrapper file (blog_wrapper.tpl) that in turn loads files containing the replaced code. This makes it easy for a theme designer to modify the layout of the blog post without disturbing the actual blog page code itself, simply by changing the order of the included files in blog_wrapper.tpl.

Default wrapper file (blog_wrapper.tpl)

The content of blog_wrapper.tpl is Smarty include statements for the following files, in this order (plus a filter to not show the navigation items when printed:

This produces a display as follows (FiveAlive theme shown).


In the image, the files the blog wrapper directly includes are in bold blue text. The relevant CSS classes are in red.

Modifying the display

By giving a theme its own blog_wrapper.tpl file (like templates/styles/my_new_theme/blog_wrapper.tpl) and then modifying it (changing the order of the included files, for example), the resulting blog post display can be changed easily and without bothering any functional code (which is contained in the included component files). (See http://themes.tiki.org/Theme-specific templates for general information about customizing template files for a theme.)

Going a step further

For a more radical layout change, any of the blog-related .tpl files can be modified for the theme. This new arrangement makes it easier to edit and maintain the custom file, since it is much smaller and more single-purpose than the old view-blog and view-blog-post templates that contained all the code for function and layout in those two files. Of course, any template customization makes maintaining the theme harder than if the theme uses CSS alone to get a distinct arrangement and appearance, but relying on CSS alone isn't always possible.

Page last modified on Saturday 27 of November, 2010 10:26:02 GMT

Switch Theme


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