twig = new \Twig\Environment($loader); } public function prepare($key, $value) { $this->data[$key] = $value; } public function display($template) { global $router; try { echo $this->twig->render("{$router->namespace}/{$template}.twig", $this->data); die(); } catch (\Twig\Error\LoaderError $e) { $this->error(500); } } public function error($errorCode) { $errorTemplate = PATH_ROOT . "/theme/default/error/{$errorCode}.twig"; if (file_exists($errorTemplate)) { echo $this->twig->render("error/{$errorCode}.twig"); } else { echo $this->twig->render("error/generic.twig"); } die(); } }