Welcome Guest, Not a member yet? Register   Sign In
Call CI library in my hook
#8

[eluser]tonanbarbarian[/eluser]
If you are using a pre_system hook the get_instance will probably not even be available.
If you are using a pre_controller hook the get_instance function may be available, but the controller has not been instanciated yet so get_instance will probably not reeturn anything meaningful
It is only once you get to the post_controller_constructor hook and beyond that you can actually do anything from the controller passed by get_instance.

Note: I am not 100% sure on this because I have not used hooks as yet but in investigating hooks and how they work this is what I have gathered from the user guide and looking at the code. If you wan to know more I suggest you look at the code in system/codeigniter/CodeIgniter.php and you should be able to follow what it is doing in a general way including where it is calling hooks and where it is creating the controller (not the load_class('Controller', FALSE) only loads the code for the controller it does not create an instance of the controller.

I think the user guide is quite good on this, however if it gave actual examples of the objects available at each stage it might make it easier for first time hook coders to determine where to put a hook and what they can access


Messages In This Thread
Call CI library in my hook - by El Forum - 07-29-2007, 07:34 PM
Call CI library in my hook - by El Forum - 08-23-2007, 01:02 PM
Call CI library in my hook - by El Forum - 10-25-2007, 02:04 PM
Call CI library in my hook - by El Forum - 10-26-2007, 02:57 AM
Call CI library in my hook - by El Forum - 10-26-2007, 04:33 AM
Call CI library in my hook - by El Forum - 10-27-2007, 01:11 AM
Call CI library in my hook - by El Forum - 12-14-2007, 06:08 AM
Call CI library in my hook - by El Forum - 12-14-2007, 03:54 PM



Theme © iAndrew 2016 - Forum software by © MyBB