00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 class PHPTAL_Attribute_METAL_Use_Macro extends PHPTAL_Attribute
00024 {
00025 function
activate(&$g, &$tag)
00026 {
00027 $g->doOBStart();
00028 $err = $tag->generateContent($g);
00029
if (PEAR::isError($err)) {
return $err; }
00030 $g->doOBClean();
00031
00032 $path = $g->newTemporaryVar();
00033
00034 $g->doAffectResult($
path,
"'".
PHPTAL_ES_path_in_string($this->expression,
"'") .
"'");
00035
00036 $temp = $g->newTemporaryVar();
00037
00038
00039 $g->execute('$__old_error = $__ctx__->_errorRaised');
00040 $g->execute('$__ctx__->_errorRaised =
false');
00041
00042 $g->doAffectResult($temp, '
new PHPTAL_Macro($__tpl__, '. $
path .
')');
00043 $g->doAffectResult($temp, $temp.'->execute($__tpl__)');
00044
00045 $g->doIf('PEAR::isError('.$temp.
')');
00046 $g->execute('$__ctx__->_errorRaised = '.$temp );
00047 $g->endBlock();
00048
00049 $g->doPrintVar($temp,
true);
00050
00051
00052 $g->doIf('!$__ctx__->_errorRaised');
00053 $g->execute('$__ctx__->_errorRaised = $__old_error');
00054 $g->endBlock();
00055 }
00056 }
00057
00058 ?>