post_controller_constructor hook not loading $this->session - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: post_controller_constructor hook not loading $this->session (/showthread.php?tid=39553) |
post_controller_constructor hook not loading $this->session - El Forum - 03-14-2011 [eluser]Webnet[/eluser] My problem is that I can't access $this->session within my Application controller. Is this functionality not available to the post_controller_constructor hook ? hooks.php Code: $hook['post_controller_constructor'] = array( application.php Code: class Application extends Controller { post_controller_constructor hook not loading $this->session - El Forum - 03-14-2011 [eluser]bubbafoley[/eluser] If you're using CI 2.0 it should look like this: Code: class Application extends CI_Controller { What is that hook supposed to be doing? It's looking for a function preController() in application/controllers/application.php which doesn't appear to exist. post_controller_constructor hook not loading $this->session - El Forum - 03-14-2011 [eluser]Webnet[/eluser] The function does exist, I didn't post the whole class because it shouldn't matter, it fails at the constructor. post_controller_constructor hook not loading $this->session - El Forum - 03-14-2011 [eluser]bubbafoley[/eluser] what is the error you are getting? post_controller_constructor hook not loading $this->session - El Forum - 03-14-2011 [eluser]Webnet[/eluser] The below class works, but my original Application controller that's loaded by the hook does not load the session. Code: class AbstractController extends Controller { Fatal error: Call to a member function userdata() on a non-object in application.php on line 47 post_controller_constructor hook not loading $this->session - El Forum - 03-14-2011 [eluser]bubbafoley[/eluser] your hook class should not be a controller. try this: hooks.php Code: $hook['post_controller_constructor'] = array( application/hooks/application.php Code: <?php post_controller_constructor hook not loading $this->session - El Forum - 03-14-2011 [eluser]Webnet[/eluser] Thanks! |