[ Index ]

PHP Cross Reference of Web Application Component Toolkit

title

Body

[close]

/framework/template/tags/core/ -> output.tag.php (source)

   1  <?php
   2  //--------------------------------------------------------------------------------
   3  // Copyright 2003 Procata, Inc.
   4  // Released under the LGPL license (http://www.gnu.org/copyleft/lesser.html)
   5  //--------------------------------------------------------------------------------
   6  /**
   7  * @package WACT_TAG
   8  * @version $Id: output.tag.php,v 1.9 2004/11/18 04:22:47 jeffmoore Exp $
   9  */
  10  
  11  /**
  12  * Register the tag
  13  */
  14  $taginfo =& new TagInfo('core:OUTPUT', 'CoreOutputTag');
  15  $taginfo->setCompilerAttributes(array('value'));
  16  $taginfo->setEndTag(ENDTAG_FORBIDDEN);
  17  TagDictionary::registerTag($taginfo, __FILE__);
  18  
  19  /**
  20  * Defines an action take, should a DataSource property have been set at runtime.
  21  * The opposite of the CoreDefaultTag
  22  * @see CoreDefaultTag
  23  * @see http://wact.sourceforge.net/index.php/CoreOutputTag
  24  * @access protected
  25  * @package WACT_TAG
  26  */
  27  class CoreOutputTag extends CompilerDirectiveTag {
  28      /**
  29      * @var Expression
  30      * @access private
  31      */
  32      var $expression;
  33  
  34      /**
  35      * @return int PARSER_REQUIRE_PARSING
  36      * @access protected
  37      */
  38  	function preParse() {
  39          $binding = $this->getAttribute('value'); 
  40          if (empty($binding)) {
  41              RaiseError('compiler', 'MISSINGREQUIREATTRIBUTE', array(
  42                  'tag' => $this->tag,
  43                  'attribute' => 'value', 
  44                  'file' => $this->SourceFile,
  45                  'line' => $this->StartingLineNo));
  46          }
  47          
  48          $this->expression =& new Expression($binding, $this, 'html');
  49  
  50          return PARSER_REQUIRE_PARSING;
  51      }
  52  
  53  	function prepare() {
  54          $this->expression->prepare();
  55          parent::prepare();
  56      }
  57      
  58      /**
  59      * @param CodeWriter
  60      * @return void
  61      * @access protected
  62      */
  63  	function preGenerate(&$code) {
  64          parent::preGenerate($code);
  65  
  66          if ($this->expression->isConstant()) {
  67              $code->writeHTML($this->expression->getValue());
  68          } else {
  69              $this->expression->generatePreStatement($code);
  70              $code->writePHP('echo ');
  71              $this->expression->generateExpression($code);
  72              $code->writePHP(';');        
  73              $this->expression->generatePostStatement($code);
  74          }
  75      }
  76  
  77  }
  78  ?>


Generated: Sun Nov 28 19:36:09 2004 Cross-referenced by PHPXref 0.5