Joomla! A User's Guide: Building a Successful Joomla! Powered Website
Publisher: Prentice Hall Pub Date: December 11, 2007 Pages: 480
Overview
If you want to build sophisticated websites that can be easily edited and updated, you need to master Joomla!-the world's #1 open source content management system. Now there's an easy-to-read, easy-to-use guide to Joomla! for every site manager, administrator, and developer. Leading Joomla! consultant Barrie North covers all you need to get results: installation, administration, site organization, template development, content updates, and a whole lot more. You'll find never-before-published tips, tricks, and troubleshooting solutions, as well as three start-to-finish case studies.
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.