function __construct()
 {
     parent::__construct();
     $this->_store = new NyaaStore();
     $this->registerResourceHandler('file', new NyaaTemplaterResourceFile());
     $this->registerResourceHandler('string', new NyaaTemplaterResourceString());
     $this->registerCompilerHandler('foreach', new NyaaTemplaterCompilerForeach());
     $this->registerCompilerHandler('if', new NyaaTemplaterCompilerIf());
     $this->registerCompilerHandler('else', new NyaaTemplaterCompilerElse());
     $this->registerFunctionHandler('debug', new NyaaTemplaterFunctionDebug());
     $this->registerModifierHandler('nl2br', new NyaaTemplaterModifierNl2br());
     $this->registerModifierHandler('url', new NyaaTemplaterModifierUrl());
     $this->registerModifierHandler('nohtml', new NyaaTemplaterModifierNohtml());
 }
예제 #2
0
<?php

require_once 'templater/templater.class.php';
$Tpl = new NyaaTemplater($this->Conf);
$Tpl->set('title', 'Test Title');
$Tpl->setTemplateDir(dirname(__FILE__));
echo $Tpl->fetch('file://sample.html');