class Controller_Session extends Controller { /** * @var string page template */ public $template = 'maintemplate'; /** * @var boolean auto render template * */ public $auto_render = true; public $user_id; // Load the template and create the $this->template object public function before($data = null) { $session = Session::instance(); $authenticated = Session::get('authenticated'); $this->user_id = Session::get('user_id'); if ($authenticated != true || !$this->user_id) { Response::redirect('welcome'); return false; } if ($this->auto_render === true) { // Load the template $this->template = \View::factory($this->template); // Set the data to the template if provided $data and $this->template->set_global($data); } return parent::before(); } // After contorller method has run output the template public function after() { if ($this->auto_render === true) { $this->response->body($this->template); } return parent::after(); } }
I'd ask: how would Fuel stop you? It's still PHP and while Fuel does a little stuff behind the scenes, a class that extends another class couldn't be prevented and why would we ever want to? Checkout the docs in General on classes, core classes and the controllers.Trav Johnston wrote on Thursday 21st of July 2011:thanks bperin, i thought that may be the case. Question: can you extend a controller that is an extenstion of an other controller? eg:
Controller_Session extends Controller
-> Controller_Admin extends Controller_Session
-> Controller_User extends Controller_Admin
Trav Johnston wrote on Thursday 21st of July 2011:Question: can you extend a controller that is an extenstion of an other controller? eg:
Controller_Session extends Controller
-> Controller_Admin extends Controller_Session
-> Controller_User extends Controller_Admin
It looks like you're new here. If you want to get involved, click one of these buttons!