PEEL Shopping
Open source ecommerce : PEEL Shopping
smarty_internal_smartytemplatecompiler.php
Go to the documentation of this file.
1 <?php
15 include ("smarty_internal_parsetree.php");
16 
24 
30  public $lexer_class;
31 
37  public $parser_class;
38 
44  public $lex;
45 
51  public $parser;
52 
58  public $smarty;
59 
65  public $local_var = array();
66 
75  {
76  $this->smarty = $smarty;
77  parent::__construct();
78  // get required plugins
79  $this->lexer_class = $lexer_class;
80  $this->parser_class = $parser_class;
81  }
82 
89  protected function doCompile($_content)
90  {
91  /* here is where the compiling takes place. Smarty
92  tags in the templates are replaces with PHP code,
93  then written to compiled files. */
94  // init the lexer/parser to compile the template
95  $this->lex = new $this->lexer_class($_content, $this);
96  $this->parser = new $this->parser_class($this->lex, $this);
97  if ($this->smarty->_parserdebug)
98  $this->parser->PrintTrace();
99  // get tokens from lexer and parse them
100  while ($this->lex->yylex() && !$this->abort_and_recompile) {
101  if ($this->smarty->_parserdebug) {
102  echo "<pre>Line {$this->lex->line} Parsing {$this->parser->yyTokenName[$this->lex->token]} Token " .
103  htmlentities($this->lex->value) . "</pre>";
104  }
105  $this->parser->doParse($this->lex->token, $this->lex->value);
106  }
107 
108  if ($this->abort_and_recompile) {
109  // exit here on abort
110  return false;
111  }
112  // finish parsing process
113  $this->parser->doParse(0, 0);
114  // check for unclosed tags
115  if (count($this->_tag_stack) > 0) {
116  // get stacked info
117  list($openTag, $_data) = array_pop($this->_tag_stack);
118  $this->trigger_template_error("unclosed {" . $openTag . "} tag");
119  }
120  // return compiled code
121  // return str_replace(array("? >\n<?php","? ><?php"), array('',''), $this->parser->retvalue);
122  return $this->parser->retvalue;
123  }
124 
125 }
126 
127 ?>
doCompile($_content)
Methode to compile a Smarty template.
__construct($lexer_class, $parser_class, $smarty)
Initialize compiler.
trigger_template_error($args=null, $line=null)
display compiler error messages without dying

This documentation for Open ecommerce PEEL Shopping and PEEL.fr has been generated by Doxygen on Thu Oct 15 2015 14:41:17 - Peel ecommerce is a product of Agence web Advisto SAS. All rights reserved.