Esempio n. 1
0
 public function generateCode(PHPTAL_Dom_Element $treeGen)
 {
     $codewriter = new PHPTAL_Php_CodeWriter($this->_state);
     $codewriter->doComment("\n*** DO NOT EDIT THIS FILE ***\n\nGenerated by PHPTAL from " . $this->_sourceFile . " (edit that file instead)");
     $codewriter->doFunction($this->_functionName, '$tpl, $ctx');
     $codewriter->setFunctionPrefix($this->_functionName . "_");
     $codewriter->doSetVar('$_thistpl', '$tpl');
     $codewriter->doSetVar('$_translator', '$tpl->getTranslator()');
     $treeGen->generateCode($codewriter);
     $codewriter->doEnd();
     return $codewriter->getResult();
 }
Esempio n. 2
0
 public function doTemplateFile($functionName, PHPTAL_Dom_Element $treeGen)
 {
     $this->doComment("\n*** DO NOT EDIT THIS FILE ***\n\nGenerated by PHPTAL from " . $treeGen->getSourceFile() . " (edit that file instead)");
     $this->doFunction($functionName, 'PHPTAL $tpl, PHPTAL_Context $ctx');
     $this->setFunctionPrefix($functionName . "_");
     $this->doSetVar('$_thistpl', '$tpl');
     $this->doInitTranslator();
     $treeGen->generateCode($this);
     $this->doComment("end");
     $this->doEnd('function');
 }