Exemplo n.º 1
0
 public function before(PHPTAL_Php_CodeWriter $codewriter)
 {
     if ($this->shouldUseCallback()) {
         $function_base_name = 'slot_' . preg_replace('/[^a-z0-9]/', '_', $this->expression) . '_' . self::$uid++;
         $codewriter->doFunction($function_base_name, 'PHPTAL $_thistpl, PHPTAL $tpl');
         $this->function_name = $codewriter->getFunctionPrefix() . $function_base_name;
         $codewriter->doSetVar('$ctx', '$tpl->getContext()');
         $codewriter->doInitTranslator();
     } else {
         $codewriter->pushCode('ob_start()');
         $this->function_name = null;
     }
 }