J1.5:Retrieving parameter data in a template file
From Joomla! Documentation
Revision as of 18:27, 14 January 2008 by Chris Davenport (Talk | contribs)
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.
Retrieving parameter data in a template file
To retrieve a Parameter in your template file use the function call
<?php $myParam = $this->params->get( 'parameterName' ); ?>
For example, retrieve the two Parameters we set on the page Defining a parameter in templateDetails.xml
For the templateColor Parameter we have set the option values blue, red, green and black, this values refers to a CSS file. So we set a link to the color CSS file.
<?php $tplColor = $this->params->get( 'templateColor' ); $this->addStyleSheet( $this->baseurl .'/templates/'. $this->template .'/css/'. $tplColor .'.css' ); ?>
For the authorCopyright Parameter we have set the option values 0 and 1 to hide or show a copyright notice for i.e. on the end of the template.
<?php if ($this->params->get( 'authorCopyright' )) : ?> <div class="copyright"> Your code... </div> <?php endif; ?>
