49 lines
1.1 KiB
PHP
49 lines
1.1 KiB
PHP
<?php
|
|
/**
|
|
* @package system.view
|
|
*/
|
|
|
|
// View_Base + PHPTAL = View_Template (View_Composite)
|
|
namespace ctiso\View;
|
|
use ctiso\View\View,
|
|
PHPTAL;
|
|
|
|
class Composite extends View
|
|
{
|
|
private $tal;
|
|
|
|
function __construct($file)
|
|
{
|
|
parent::__construct();
|
|
|
|
$this->tal = new PHPTAL($file);
|
|
$this->tal->setPhpCodeDestination(PHPTAL_PHP_CODE_DESTINATION);
|
|
$this->tal->setEncoding(PHPTAL_DEFAULT_ENCODING); // PHPTAL_DEFAULT_ENCODING !!
|
|
$this->tal->setTemplateRepository(PHPTAL_TEMPLATE_REPOSITORY);
|
|
$this->tal->setOutputMode(PHPTAL::HTML5);
|
|
$this->tal->stripComments(true);
|
|
// $this->tal->addPreFilter(new PHPTAL_PreFilter_Normalize());
|
|
}
|
|
|
|
function set($key, $val) {
|
|
if ($key == 'title') {
|
|
$this->setTitle($val);
|
|
}
|
|
$this->tal->set($key, $val);
|
|
}
|
|
|
|
function __set($key, $val) {
|
|
$this->tal->set($key, $val);
|
|
}
|
|
|
|
function execute()
|
|
{
|
|
parent::execute();
|
|
// postProcess
|
|
return $this->tal->execute();
|
|
}
|
|
|
|
function setTranslator($t) {
|
|
$this->tal->setTranslator($t);
|
|
}
|
|
}
|