Actions

J1.5

Difference between revisions of "Storing template parameter values"

From Joomla! Documentation

(New page: The current values of the template parameters are stored in the file <tt>[path-to-Joomla]/templates/[template-name]/params.ini</tt> If your template has parameters and you intend to creat...)
 
m
Line 15: Line 15:
 
The installer will ensure that the ''params.ini'' file has the correct ownership and permissions and so is writeable.
 
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 <tt><param></tt> 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:
+
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 <tt><param></tt> 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:
 
# On your test system, create an empty ''params.ini'' file, making sure that it is writeable by the web server.
 
# On your test system, create an empty ''params.ini'' file, making sure that it is writeable by the web server.
 
# Log in to the Administrator back-end and go to the '''Template Parameters''' screen for your template.
 
# Log in to the Administrator back-end and go to the '''Template Parameters''' screen for your template.
Line 22: Line 22:
 
# Take a copy of your ''params.ini'' file to put into the template package.  This now contains all the default parameter values.
 
# Take a copy of your ''params.ini'' file to put into the template package.  This now contains all the default parameter values.
  
Alternatively, you can create a ''params.ini'' file by hand as the format is very simple.  It is in standard INI file format with one parameter per line.  The parameter name and its value separated by an equals sign.  For example
+
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:
 
<source lang="ini">
 
<source lang="ini">
 
templateColour=blue
 
templateColour=blue

Revision as of 15:42, 20 August 2008

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