Actions

J1.5

Storing template parameter values

From Joomla! Documentation

Replacement filing cabinet.png
This Namespace has been archived - Please Do Not Edit or Create Pages in this namespace. Pages contain information for a Joomla! version which is no longer supported. It exists only as a historical reference, will not be improved and its content may be incomplete.

The current values of the template parameters are stored in the file [path-to-Joomla]/templates/[template-name]/params.ini

If your template has parameters and you intend to create an installer package for it, then you should add this file to the <files> section of the templateDetails.xml file.

<files>
        ........
 
        <filename>params.ini</filename>
 
        ........
 
</files>

The installer will ensure that the params.ini file has the correct ownership and permissions and so is writeable.

The params.ini file distributed in a template installer package can actually be empty as the default values of the parameters can be set in the <param> elements in the templateDetails.xml file. The presence of the empty file during template installation just ensures that it is writeable. However, if you want to distribute a params.ini file with the default parameter values set in it, this is a simple procedure for creating one:

  1. On your test system, create an empty params.ini file, making sure that it is writeable by the web server.
  2. Log in to the Administrator back-end and go to the Template Parameters screen for your template.
  3. Set all the parameters to the values that you want as the defaults.
  4. Click Save.
  5. Take a copy of your params.ini file to put into the template package. This now contains all the default parameter values.

Alternatively, as the format is very simple, you can create a params.ini file by hand. It is in standard INI file format with one parameter per line. The parameter name and its value are separated by an equals sign. For example:

templateColour=blue
authorCopyright=1