public function format($template) { $view_name = 'View_' . $template; $view = new $view_name(); $view->data = $this->data; $renderer = \Kostache_Layout::factory($this->layout); return $renderer->render($view); }
/** * Set the response body to $this->view if $this->view is defined.. */ public function after() { if ($this->view != NULL) { $renderer = Kostache_Layout::factory(); $renderer->set_layout($this->layout); $this->response->body($renderer->render($this->view)); } }
public function get_response() { $view = new View_Error_404(); $renderer = Kostache_Layout::factory('404'); $response = Response::factory()->status(404); $response->body($renderer->render($view)); return $response; }
public function action_login() { $content = new View_LoginPage(); $content->isLoginPage = true; if (isset($_GET['type'])) { $content->type = $_GET['type']; } $renderer = Kostache_Layout::factory('layout'); $this->response->body($renderer->render($content)); }
/** * Load [Kostache_Layout] and POO View * * Attempts to load a POO View based on the names of the Controller and Action requested **/ public function before() { parent::before(); if ($this->auto_render === TRUE) { $this->layout = Kostache_Layout::factory('layout/default'); $view = 'View_' . ucfirst(Request::initial()->controller()) . '_' . ucfirst(Request::initial()->action()); if (class_exists($view)) { $this->view = new $view(); } } }
/** * Run CSRF check and load frontend assets. */ public function get_response() { // Lets log the Exception, Just in case it's important! Kohana_Exception::log($this); if (Kohana::$environment >= Kohana::DEVELOPMENT) { // Show the normal Kohana error page. return parent::get_response(); } $response = Response::factory(); $assets = Kohana::$config->load('assets.global'); $this->_load_assets($assets); $view = new View_Error(); $view->title = $this->getCode(); $view->message = $this->getMessage(); $renderer = Kostache_Layout::factory(); $response->body($renderer->render($view)); return $response; }
public function after() { $renderer = Kostache_Layout::factory(); $renderer->set_layout('install/layout'); $this->response->body($renderer->render($this->_view)); }