// require_once PHPTAL_DIR.'PHPTAL/Php/Attribute.php'; // TAL Specifications 1.4 // // argument ::= (['text'] | 'structure') expression // // Example: // //

// My name is .
// (My login name is // Unknown) //

// /** * @package phptal.php.attribute.tal * @author Laurent Bedubourg */ class PHPTAL_Php_Attribute_TAL_OnError extends PHPTAL_Php_Attribute { const ERR_VAR = '$__err__'; public function start() { $this->tag->generator->doTry(); $this->tag->generator->pushCode('ob_start()'); } public function end() { $this->tag->generator->pushCode('ob_end_flush()'); $this->tag->generator->doCatch('Exception '.self::ERR_VAR); $this->tag->generator->pushCode('$tpl->addError('.self::ERR_VAR.')'); $this->tag->generator->pushCode('ob_end_clean()'); $expression = $this->extractEchoType($this->expression); $code = $this->tag->generator->evaluateExpression($expression); switch ($code) { case PHPTAL_TALES_NOTHING_KEYWORD: break; case PHPTAL_TALES_DEFAULT_KEYWORD: $this->tag->generator->pushHtml('
tag->generator->doEcho(self::ERR_VAR);
                $this->tag->generator->pushHtml('
'); break; default: $this->doEcho($code); break; } $this->tag->generator->doEnd(); } } ?>