CodeIgniter Forums
Use the codeigniter library in hook class or function,HOWTO - 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: Use the codeigniter library in hook class or function,HOWTO (/showthread.php?tid=9722)



Use the codeigniter library in hook class or function,HOWTO - El Forum - 07-06-2008

[eluser]Unknown[/eluser]
Hi all:
How use the codeigniter library in hook class or function, such as database class.
Hook Point: pre_controller.
Tks.


Use the codeigniter library in hook class or function,HOWTO - El Forum - 07-07-2008

[eluser]Seppo[/eluser]
If you want to use a library, you would need to use a hook at least in post_controller_constructor. There you can be sure the basic core is loaded.
Then you can use get_instance() to get the controller object and access to the libraries.


Use the codeigniter library in hook class or function,HOWTO - El Forum - 07-08-2008

[eluser]Unknown[/eluser]
Thank you very much, Seppo!
I now understand.