public function initialize() { parent::initialize(); require_once "{$this->dir}/php-stl/PHPSTL.php"; require_once "{$this->dir}/FrameworkCompiler.php"; require_once "{$this->dir}/Template.php"; if ($this->hasModule('PageSystem')) { require_once "{$this->dir}/ContentPageTemplateProvider.php"; } PHPSTL::registerNamespace('urn:redtree:ui:form:v1.0', 'TemplateFormHandler', dirname(__FILE__) . '/TemplateFormHandler.php'); if ($this->hasModule('PageSystem')) { PHPSTL::registerNamespace('urn:redtree:ui:page:v1.0', 'TemplatePageHandler', dirname(__FILE__) . '/TemplatePageHandler.php'); } $this->site->addCallback('onPostConfig', array($this, 'onPostConfig')); }
* @param args mixed array or null * @return string * @see load, PHPSTLTemplate::render */ public function process($resource, $args = null) { $template = $this->load($resource); return $template->render($args); } } class PHPSTLNoSuchResource extends RuntimeException { private $pstl; public function getPHPSTL() { return $this->pstl; } private $resource; public function getResource() { return $this->resource; } public function __construct(PHPSTL $pstl, $resource) { $this->pstl = $pstl; $this->resource = $resource; parent::__construct("No such template {$resource}"); } } PHPSTL::registerNamespace('urn:redtree:php-stl:core:v2.0', 'PHPSTLCoreHandler', dirname(__FILE__) . '/PHPSTLCoreHandler.php');