Joomla 1.5 offers a number of advanced template features that significantly expand what is possible with templates. We have already seen one example in this chapter, the ability to create custom chrome or output for modules. Let's examine each of these in turn:
Template Parameters
Template Overrides
Template Parameters
New in 1.5 is the addition of template parameters for templates. This allows you to pass variables to the template from options selected in the administrative backend.
We can add a relatively simple parameter function to our template. In the templateDetails.xml file, add the following:
<params> <param name="template_width" type="list" default="fluid" label="Template Width" description="Width style of the template"> <option value="fluid">Fluid with maximum and minimum</option> <option value="medium">Medium</option> <option value="small">Small</option> </param> </params>
You will also need a file called params.ini in your template folder. It can be a blank file, but Joomla needs this file to store what settings you have. For example, an INI file for the previous example might look like this:
template_width=2
You need to make sure that this file is writable so changes can be made. We will also need to add that as a file in the templateDetails.xml file.
In the Template Manager for that template, you will see the settings for the parameter, as shown in Figure 9.11.