Welcome Guest, Not a member yet? Register   Sign In
make $CI (superobject) global?
#1

[eluser]ajsie[/eluser]
i have auto-loaded models and libraries, but before i can use them in my models and library classes i have to type like this:

$CI =& get_instance();
$CI->classname->method();

and that's annoying to have to have the first line all the time. so i thought i could have that line in a pre_controller hook.

however, i have to make $CI global for it to work (or that variable will only live in the hook method)

i tried this in the pre_controller hook:

Code:
public function set() {
      global $CI;
      $CI =& get_instance();
}

but it didnt work. how could i make $CI global through the whole application?

thanks!


Messages In This Thread
make $CI (superobject) global? - by El Forum - 04-12-2010, 11:34 PM
make $CI (superobject) global? - by El Forum - 04-13-2010, 01:12 AM
make $CI (superobject) global? - by El Forum - 04-13-2010, 01:22 AM
make $CI (superobject) global? - by El Forum - 04-13-2010, 01:52 AM
make $CI (superobject) global? - by El Forum - 04-13-2010, 02:01 AM



Theme © iAndrew 2016 - Forum software by © MyBB