* @author Kornel LesiƄski * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License * @version SVN: $Id$ * @link http://phptal.org/ */ /** * METAL Specification 1.0 * * argument ::= Name * * Example: * * * * *
Links
* A Link *
* * PHPTAL: (access to slots may be renamed) * * * * * * slots->links)): ? > * slots->links ? > * * *
Links
* A Link *
* * * @package PHPTAL * @subpackage Php.attribute.metal * @author Laurent Bedubourg */ class PHPTAL_Php_Attribute_METAL_DefineSlot extends PHPTAL_Php_Attribute { private $tmp_var; public function before(PHPTAL_Php_CodeWriter $codewriter) { $this->tmp_var = $codewriter->createTempVariable(); $codewriter->doSetVar($this->tmp_var, $codewriter->interpolateTalesVarsInString($this->expression)); $codewriter->doIf('$ctx->hasSlot('.$this->tmp_var.')'); $codewriter->pushCode('$ctx->echoSlot('.$this->tmp_var.')'); $codewriter->doElse(); } public function after(PHPTAL_Php_CodeWriter $codewriter) { $codewriter->doEnd('if'); $codewriter->recycleTempVariable($this->tmp_var); } }