Support Joomla!

Packages

Package: patTemplate

License

Content on this site is copyright © 2005 - 2008 Open Source Matters Inc and can be used in accordance with the Joomla! Electronic Documentation License. Some parts of this website may be subject to other licenses.
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 10381 2008-06-01 03:35:53Z pasamio $
  7.  *
  8.  * @package        patTemplate
  9.  * @subpackage    Functions
  10.  * @author        Sebastian Mordziol <argh@php-tools.net>
  11.  * @author        Stephan Schmidt <schst@php.net>
  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 10381 2008-06-01 03:35:53Z pasamio $
  28.  *
  29.  * @package        patTemplate
  30.  * @subpackage    Functions
  31.  * @author        Sebastian Mordziol <argh@php-tools.net>
  32.  * @author        Stephan Schmidt <schst@php.net>
  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 Sun, 21 Dec 2008 20:45:45 +0000 by phpDocumentor 1.3.1