Jun 24
2008

Template overrides - part 1

Posted by: Bill Tomczak

Tagged in: templates , joomla 1.5

One of the more exciting improvements in Joomla! 1.5 is the idea of template overrides. Joomla! templates can be thought of as a wrapper for displaying content produced by the various Joomla! components, modules and plugins/mambots. If you've ever created your own template, you know that there is special code you place throughout it to display that content. You can carefully create html according to your own exacting standards, but the results of all those modules in the left position, for example will still produce whatever html those modules were programmed to produce.

So let's say you've decided to create a website that does not use all those nested tables. You could create a Joomla! template that is all divs and no tables, but the individual Joomla! extensions will still be outputting those pesky nested tables.

With modules, you at least have the choice of using the tableless 'xhtml' style. But here again, the style attribute only tells Joomla! how to wrap the content produced by the module. The module itself may still be outputting table tags that you would rather not see used.

Left to its own devices, Joomla! components still rely on tables as primary means of displaying content.

Aside from this example, some components may not be producing output the way you might like to see it. We've found that the contact component in particular produces some ugly html.

So what to do? In the past, you could go into Joomla! core code to rewrite the output routines. This opens you up to the possibility that some or all of your careful work might get wiped out in the next Joomla! upgrade.

And this is why we are so happy with the introduction of template overrides. We can no completely rewrite all the html rendering code without touching core code. It becomes a feature of the template itself and further separates the content of your site from presentation.

My next series of blog posts will discuss how to create and work with template overrides.

Powered by Azrul's MyBlog for Joomla!