1guywebdesign rambles on about open source technologies like joomla and wordpress.

1guy is also the core developer of mojoBlog, a semantic blogging component joomla based on the ever popular blog tool, wordpress.

Using Multiple Templates in Joomla

The option to relate a Joomla template to a particular menu item has been around for quite awhile but I’ve never found myself either using or needing this feature until recently when I needed to display a client’s blog in a style different than their current joomla design.

As part of my ongoing Joomla CMS “learning curve” I’ve been working on getting tighter integration between certain 3rd party components and the Joomla core. In particular, Marko’s port of the popular Blog tool WordPress (com_jd-wp) and getting jd-wp to correctly append the blog post “title” to the webpage title much along the same vein as the core does with all “com_content” posts.

Until I’m happy with the results, I needed a way for my client’s blog titles to display (for search engine results, ease in bookmarking posts/pages, etc.,) correctly.

A somewhat novel work-around to achieve these goals was to replace the <head> meta from the existing joomla index.php with the wordpress specific meta and variables required to get post id and info from the client’s database and insert it in the proper areas.

Joomla uses a core function called addCustomHeadTag as a container to receive pageload information prior to page display. Additional joomla functions setPageTitle, addMetaTag, appendMetaTag are used to retrieve and add this respective data from db queries, eventually added to the addCustomHeadTag and stuffed into the appropriate placeholders found in the head section of the default template index.php.

Wordpress uses similar functions but, short of writing a mambot (a plugin for joomla) to sniff for the presence of jd-wp, cull and parse the relevant jd-wp meta and replacing existing joomla head meta with jd-wp post title, post meta, etc., I opted for a less elegant approach.

Two identical templates with the exception of the head meta. One template-default joomla, the other replaces joomla meta placeholders with the equivalent wordpress (jd-wp) meta placeholders.

So, by assigning a “wordpress enhanced” joomla template to all references to the jd-wp component menuID I’m able to display the correct jd-wp post title and post meta for all blog instances yet switch back to joomla meta when viewing other parts/sections of the client’s joomla website.

Blog Features and Options Menu

Categories