* @author Kornel LesiĆski
* @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License
* @version SVN: $Id: DefineSlot.php 605 2009-05-03 02:50:26Z kornel $
* @link http://phptal.org/
*/
/**
* METAL Specification 1.0
*
* argument ::= Name
*
* Example:
*
*
*
*
*
*
* PHPTAL: (access to slots may be renamed)
*
*
*
*
*
* slots->links)): ? >
* slots->links ? >
*
*
*
*
*
* @package PHPTAL
* @subpackage Php.attribute.metal
* @author Laurent Bedubourg
*/
class PHPTAL_Php_Attribute_METAL_DefineSlot extends PHPTAL_Php_Attribute
{
public function before(PHPTAL_Php_CodeWriter $codewriter)
{
$codewriter->doIf('$ctx->hasSlot('.$codewriter->str($this->expression).')');
$codewriter->pushCode('echo $ctx->getSlot('.$codewriter->str($this->expression).')');
$codewriter->doElse();
}
public function after(PHPTAL_Php_CodeWriter $codewriter)
{
$codewriter->doEnd();
}
}