Example #1
0
 /**
  * This method gets called after the action is called.
  *
  * @param mixed $response Value returned from the action method.
  * 
  * @return Response $response
  */
 public function after($response)
 {
     // Return if passed a response.
     if ($response instanceof Response) {
         return parent::after($response);
     }
     if ($this->autorender) {
         try {
             $this->view->set_filename(Str::lower(str_replace('_', '/', Inflector::denamespace(str_replace('controller_', '', Str::lower($this->request->controller)))) . DS . str_replace('_', '/', $this->request->action)));
         } catch (FuelException $e) {
         }
     }
     // Inject view into the layout if the main request.
     if ($this->layout instanceof View) {
         if ($this->autorender) {
             try {
                 // Throws exception if there is no view template found.
                 $this->layout->content = $this->view->render();
             } catch (FuelException $e) {
             }
         }
         $this->layout->content_data = $this->view->get();
         $this->response->body($this->layout);
     } else {
         $this->response->body($this->view);
     }
     return parent::after($this->response);
 }
Example #2
0
 public function set_filename($file)
 {
     $theme = Kohana::$config->load('site.theme');
     if (($path = Kohana::find_file('views', 'themes/' . $theme . '/' . $file)) !== FALSE) {
         $this->_file = $path;
         return $this;
     }
     // By default try use common view
     return parent::set_filename($file);
 }
Example #3
0
 /**
  * Sets the view filename.
  *
  * @chainable
  * @param   string  view filename
  * @param   string  view file type
  * @return  object
  */
 public function set_filename($name, $type = NULL)
 {
     $name = 'admin/' . $name;
     return parent::set_filename($name, $type);
 }