Support Joomla!

Joomla! 1.5 Documentation

Packages

Package: patTemplate

Developer Network License

The Joomla! Developer Network content is © copyright 2006 by the individual contributors and can be used in accordance with the Creative Commons License, Attribution- NonCommercial- ShareAlike 2.5
Source code for file /pattemplate/patTemplate/Function/Globalvar.php

Documentation is available at Globalvar.php

  1. <?PHP
  2. /**
  3.  * patTemplate function that enables adding global variables
  4.  * from within a template.
  5.  *
  6.  * $Id: Globalvar.php 221 2004-05-28 15:45:08Z schst $
  7.  *
  8.  * @package        patTemplate
  9.  * @subpackage    Functions
  10.  * @author        Sebastian Mordziol <[email protected]>
  11.  * @author        Stephan Schmidt <[email protected]>
  12.  */
  13.  
  14. // Check to ensure this file is within the rest of the framework
  15. defined('JPATH_BASE'or die();
  16.  
  17. /**
  18.  * patTemplate function that enables adding global variables
  19.  * from within a template.
  20.  *
  21.  * Available attributes:
  22.  *
  23.  * name     >  name of the variable
  24.  * default  >  default value of the variable
  25.  * hidden   >  whether to output the content of the variable: yes|no
  26.  *
  27.  * $Id: Globalvar.php 221 2004-05-28 15:45:08Z schst $
  28.  *
  29.  * @package        patTemplate
  30.  * @subpackage    Functions
  31.  * @author        Sebastian Mordziol <[email protected]>
  32.  * @author        Stephan Schmidt <[email protected]>
  33.  */
  34. {
  35.    /**
  36.     * name of the function
  37.     * @access    private
  38.     * @var        string 
  39.     */
  40.     var $_name    =    'Globalvar';
  41.  
  42.    /**
  43.     * reference to the patTemplate object that instantiated the module
  44.     *
  45.     * @access    protected
  46.     * @var    object 
  47.     */
  48.     var    $_tmpl;
  49.  
  50.    /**
  51.     * set a reference to the patTemplate object that instantiated the reader
  52.     *
  53.     * @access    public
  54.     * @param    object        patTemplate object
  55.     */
  56.     function setTemplateReference&$tmpl )
  57.     {
  58.         $this->_tmpl        =    &$tmpl;
  59.     }
  60.  
  61.    /**
  62.     * call the function
  63.     *
  64.     * @access    public
  65.     * @param    array    parameters of the function (= attributes of the tag)
  66.     * @param    string    content of the tag
  67.     * @return    string    content to insert into the template
  68.     */
  69.     function call$params$content )
  70.     {
  71.         ifisset$params['default') )
  72.         {
  73.             $this->_tmpl->addGlobalVar$params['name']$params['default');
  74.         }
  75.  
  76.         if!isset$params['hidden') )
  77.         {
  78.             $params['hidden''no';
  79.         }
  80.  
  81.         if$params['hidden'!= 'yes' )
  82.             return $this->_tmpl->getOption('startTag').strtoupper($params['name']).$this->_tmpl->getOption('endTag');
  83.  
  84.         return '';
  85.     }
  86. }
  87. ?>

Documentation generated on Mon, 05 Mar 2007 21:05:10 +0000 by phpDocumentor 1.3.1