Loading...
 
Skip to main content

History: Blog layout

Source of version: 1

Copy to clipboard
            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 (.tpl) files (tiki-view_blog.tpl and tiki-view_blog_post.tpl) were separated into distinct files, a wrapper file (blog_wrapper.tpl) and blog post component files. 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 ([http://tikiwiki.svn.sourceforge.net/viewvc/tikiwiki/branches/6.x/templates/blog_wrapper.tpl|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:
* [http://tikiwiki.svn.sourceforge.net/viewvc/tikiwiki/branches/6.x/templates/blog_post_postbody_title.tpl|blog_post_postbody_title.tpl]
* [http://tikiwiki.svn.sourceforge.net/viewvc/tikiwiki/branches/6.x/templates/blog_post_author_info.tpl|blog_post_author_info.tpl]
* [http://tikiwiki.svn.sourceforge.net/viewvc/tikiwiki/branches/6.x/templates/blog_post_postbody_content.tpl|blog_post_postbody_content.tpl]
* [http://tikiwiki.svn.sourceforge.net/viewvc/tikiwiki/branches/6.x/templates/blog_post_author_actions.tpl|blog_post_author_actions.tpl]
* [http://tikiwiki.svn.sourceforge.net/viewvc/tikiwiki/branches/6.x/templates/blog_post_actions.tpl|blog_post_actions.tpl]
* [http://tikiwiki.svn.sourceforge.net/viewvc/tikiwiki/branches/6.x/templates/blog_post_status.tpl|blog_post_status.tpl]
* [http://tikiwiki.svn.sourceforge.net/viewvc/tikiwiki/branches/6.x/templates/blog_post_navigation.tpl|blog_post_navigation.tpl]
This produces a display as follows (FiveAlive theme shown). 

{IMG(src="display114")}{IMG}

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.  
        

History

Advanced
Information Version
Sat 27 of Nov, 2010 10:26 GMT-0000 Gary Cunningham-Lee Improved text. 2
Sat 27 of Nov, 2010 10:14 GMT-0000 Gary Cunningham-Lee Page created. 1