//
require_once PHPTAL_DIR.'PHPTAL/Php/Attribute.php';
// TAL Specifications 1.4
//
// argument ::= (['text'] | 'structure') expression
//
// Example:
//
//
Fred Farkas
//
//
require_once PHPTAL_DIR.'PHPTAL/Php/TalesChainExecutor.php';
/**
* @package phptal.php.attribute.tal
* @author Laurent Bedubourg
*/
class PHPTAL_Php_Attribute_TAL_Content
extends PHPTAL_Php_Attribute
implements PHPTAL_Php_TalesChainReader
{
public function start()
{
$expression = $this->extractEchoType($this->expression);
$code = $this->tag->generator->evaluateExpression($expression);
if (is_array($code)) {
return $this->generateChainedContent($code);
}
if ($code == PHPTAL_TALES_NOTHING_KEYWORD) {
return;
}
if ($code == PHPTAL_TALES_DEFAULT_KEYWORD) {
return $this->generateDefault();
}
$this->doEcho($code);
}
public function end()
{
}
private function generateDefault()
{
$this->tag->generateContent(true);
}
private function generateChainedContent($code)
{
$executor = new PHPTAL_Php_TalesChainExecutor($this->tag->generator, $code, $this);
}
public function talesChainPart(PHPTAL_Php_TalesChainExecutor $executor, $exp, $islast)
{
$executor->doIf('!phptal_isempty($__content__ = '.$exp.')');
$this->doEcho('$__content__');
}
public function talesChainNothingKeyword(PHPTAL_Php_TalesChainExecutor $executor)
{
$executor->breakChain();
}
public function talesChainDefaultKeyword(PHPTAL_Php_TalesChainExecutor $executor)
{
$executor->doElse();
$this->generateDefault();
$executor->breakChain();
}
}
?>