Difference between revisions of "Defining a parameter in templateDetails.xml"
From Joomla! Documentation
m (text formatting to prevent scrollbars) |
m (1 revision(s)) |
(No difference)
|
Revision as of 18:27, 14 January 2008
The "J1.5" namespace is an archived namespace. This page contains information for a Joomla! version which is no longer supported. It exists only as a historical reference, it will not be improved and its content may be incomplete and/or contain broken links.
Defining a parameter in templateDetails.xml[edit]
Template Parameters gives you the possibility to pass variables to the template. The <params> element contains sub-elements for each Parameter that is set for the template. The site administrator can change the values of Parameters from the "Template: [ Edit ]" page in the Back-end.
For example, we set up two Parameters (Template color variation, show/hide Author Copyright).
<params>
<param name="templateColor" type="list" default="blue"
label="Template Color" description="Choose the template color.">
<option value="blue">Blue</option>
<option value="red">Red</option>
<option value="green">Green</option>
<option value="black">Black</option>
</param>
<param name="authorCopyright" type="radio" default="1"
label="Author Copyright" description="Show/Hide author copyright.">
<option value="0">hide</option>
<option value="1">show</option>
</param>
</params>
In the Template Manager -> Template: [ Edit ] page you now see a block "Parameters" with the two Parameters we defined above. To retrieve the Parameters in your template index.php see Retrieving parameter data in a template file
Note: In order that the Parameters works you need a file called params.ini in your template root folder. This file is used by Joomla! to store the settings for the Parameters. It can be a blank file, but it must be writeable so changes can be made.
For the example above the file looks like this.
templateColor=blue
authorCopyright=1