public function __construct($title, $template, $data = [], $options = [], $headers = []) { parent::__construct(); $this->title = $title; $this->template = $template; $this->data = $data; $this->options = $options; $this->setCallback(function () use($title, $template, $data, $options) { $view = new NWTemplate(); $view->displayPage($template, $title, $data, $options); }); $this->headers = new ResponseHeaderBag($headers); }
public function testSyntaxAll() { chdir("deploy"); $engine = new NWTemplate(); ob_start(); $engine->compileAllTemplates(".tpl", true); $result = ob_get_contents(); ob_end_clean(); chdir("../"); $failed_templates = []; preg_match_all('/^.*Syntax error.*$/im', $result, $failed_templates); $this->assertCount(0, $failed_templates[0], implode("\n", $failed_templates[0])); }
/** * Return 404 and 404 headers */ public static function respond404() { header($_SERVER['SERVER_PROTOCOL'] . " 404 Not Found", true, 404); //.replace = true $view = new NWTemplate(); $view->display('404.tpl'); }