![]() |
Hooks and base classes - 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: Hooks and base classes (/showthread.php?tid=35356) |
Hooks and base classes - El Forum - 10-27-2010 [eluser]tuope[/eluser] Hello! If I use 'pre_controller' hooks, I can use CodeIgniter resources (available from `get_instance()') in my hooks, can't I? Page "http://ellislab.com/codeigniter/user-guide/general/hooks.html" states that in pre_controller phase "All base classes, routing, and security checks have been done". This means that all core classes ("http://ellislab.com/codeigniter/user-guide/general/core_classes.html") are available, right? Tuomas P.S. I must say that the CodeIgniter User Guide is a fantastic piece of documentation! :-) Hooks and base classes - El Forum - 10-27-2010 [eluser]WanWizard[/eluser] The pre-controller hooks is called, as the name implies, before the controller is instantiated. So no access to the CI superobject. The CI object is available in the post_controller_constructor hook. You can access the classes already loaded via Code: // in CI 1.7.2. use Hooks and base classes - El Forum - 10-28-2010 [eluser]tuope[/eluser] Thank you very much. You probably saved me several hours of frustration caused by my misunderstanding. :-) |