public function action_error() { $code = $this->response->status; $message = $this->template->message; $this->template = Twig_View::factory('error/' . $code); $this->template->set('message', $message); }
public function before() { if ($this->auto_render) { // Auto-generate template filename ('index' method called on Controller_Admin_Users looks for 'admin/users/index') if ($this->template === NULL) { $this->template = $this->request->controller() . DIRECTORY_SEPARATOR . $this->request->action(); if ($this->request->directory()) { // Preprend directory if needed $this->template = $this->request->directory() . DIRECTORY_SEPARATOR . $this->template; } } $this->template = Twig_View::factory($this->template); } }
/** * Constructor * * @param Request $request * @author Jonathan Geiger */ public function __construct(Request $request) { // Auto-generate template filename if (empty($this->template)) { $this->template = $request->controller . '/' . $request->action; // Prepend directory if needed if (!empty($request->directory)) { $this->template = $request->directory . '/' . $this->template; } // Convert underscores to slashes $this->template = str_replace('_', '/', $this->template); } // Create the initial context object $this->template = Twig_View::factory($this->template, $this->twig); $this->twig = $this->template->environment(); parent::__construct($request); }