예제 #1
0
파일: Ajax.php 프로젝트: NegoCore/core
 /**
  * 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);
 }
예제 #2
0
파일: Template.php 프로젝트: NegoCore/core
 /**
  * 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);
     }
 }