Welcome Guest, Not a member yet? Register   Sign In
get_instance returns empty object
#1

[eluser]Hartimer[/eluser]
Hi

I'm trying to work with hooks but i'm getting a really anoying error

Code:
Fatal error: Call to a member function helper() on a non-object in /<whatever>/system/application/hooks/my_hook.php on line 6

The hook looks like this:

Code:
&lt;?php if (!defined('BASEPATH')) exit('No direct script access allowed');

class My_hook {
    public function __construct(){
        $this->obj =& get_instance();
        $this->obj->load->helper('url'); // this is line 6
    }
}

I've seen tones of demos where get_instance works like a charm, including on hooks... have no idea why i'm getting this, but i believe it is a really silly mistake..


Messages In This Thread
get_instance returns empty object - by El Forum - 10-30-2009, 01:33 PM
get_instance returns empty object - by El Forum - 10-30-2009, 02:18 PM
get_instance returns empty object - by El Forum - 10-30-2009, 02:31 PM
get_instance returns empty object - by El Forum - 10-30-2009, 02:50 PM
get_instance returns empty object - by El Forum - 10-30-2009, 03:26 PM
get_instance returns empty object - by El Forum - 10-30-2009, 03:30 PM
get_instance returns empty object - by El Forum - 10-30-2009, 05:51 PM



Theme © iAndrew 2016 - Forum software by © MyBB