/** * Format response content */ public function after() { parent::after(); // If response is an array or format requested is JSON, encode it if ($this->request->param('format') == 'json' || is_array($this->_response)) { $this->response->headers('Content-Type', 'application/json'); $this->_response = json_encode($this->_response); } // Assign to body $this->response->body($this->_response); }
/** * Generate HTML code from page */ public function after() { parent::after(); if ($this->auto_render) { // Generate default filename if ($this->view->get_filename() === null) { $this->view->set_filename($this->find_view()); } // Messages & Errors $this->view->set('message', Session::instance()->get_once('message')); $this->view->set('errors', Session::instance()->get_once('errors')); // Set body $this->response->body($this->view); } }