[ Index ]

PHP Cross Reference of Joomla 1.5.26 DE

title

Body

[close]

/libraries/pattemplate/patTemplate/Function/ -> Globalvar.php (source)

   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  class patTemplate_Function_Globalvar extends patTemplate_Function
  35  {
  36      /**
  37      * name of the function
  38      * @access    private
  39      * @var        string
  40      */
  41      var $_name    =    'Globalvar';
  42  
  43      /**
  44      * reference to the patTemplate object that instantiated the module
  45      *
  46      * @access    protected
  47      * @var    object
  48      */
  49      var    $_tmpl;
  50  
  51      /**
  52      * set a reference to the patTemplate object that instantiated the reader
  53      *
  54      * @access    public
  55      * @param    object        patTemplate object
  56      */
  57  	function setTemplateReference( &$tmpl )
  58      {
  59          $this->_tmpl        =    &$tmpl;
  60      }
  61  
  62      /**
  63      * call the function
  64      *
  65      * @access    public
  66      * @param    array    parameters of the function (= attributes of the tag)
  67      * @param    string    content of the tag
  68      * @return    string    content to insert into the template
  69      */
  70  	function call( $params, $content )
  71      {
  72          if( isset( $params['default'] ) )
  73          {
  74              $this->_tmpl->addGlobalVar( $params['name'], $params['default'] );
  75          }
  76  
  77          if( !isset( $params['hidden'] ) )
  78          {
  79              $params['hidden'] = 'no';
  80          }
  81  
  82          if( $params['hidden'] != 'yes' )
  83              return $this->_tmpl->getOption('startTag').strtoupper($params['name']).$this->_tmpl->getOption('endTag');
  84  
  85          return '';
  86      }
  87  }
  88  ?>


Generated: Wed Mar 28 15:54:07 2012 Cross-referenced by PHPXref 0.7.1