public function generateCode(PHPTAL_Php_CodeWriter $codewriter) { // For backwards compatibility only! self::$_codewriter_bc_hack_ = $codewriter; // FIXME try { /// self-modifications $this->replacePHPAttributes(); if ($codewriter->getOutputMode() === PHPTAL::XHTML) { $this->replaceTextWithCDATA(); } /// code generation if ($codewriter->isDebugOn()) { $codewriter->doSetVar('$ctx->_line', $this->getSourceLine()); $codewriter->doComment('tag "' . $this->qualifiedName . '" from line ' . $this->getSourceLine()); } $this->generateSurroundHead($codewriter); if (count($this->replaceAttributes)) { foreach ($this->replaceAttributes as $att) { $att->before($codewriter); $att->after($codewriter); } } elseif (!$this->hidden) { // a surround tag may decide to hide us (tal:define for example) $this->generateHead($codewriter); $this->generateContent($codewriter); $this->generateFoot($codewriter); } $this->generateSurroundFoot($codewriter); } catch (PHPTAL_TemplateException $e) { $e->hintSrcPosition($this->getSourceFile(), $this->getSourceLine()); throw $e; } }