I am trying to write a hook for my Codeigniter
application.
I'm trying to catch a session
in my hook
.
Here is my code to load the hook:
$hook['pre_controller'] = array(
'function' => 'getNav',
'filename' => 'LoadNav.php',
'filepath' => 'hooks'
);
And here is the code I'm trying to load in the hook:
function getNav()
{
$CI =& get_instance();
$level = $CI->session->userdata('level');
}
It keeps throwing an error which is the following:
A PHP Error was encountered
Severity: Notice
Message: Trying to get property of non-object
Filename: hooks/LoadNav.php
Line Number: 7
Any idea of what I'm doing wrong? It seems like the get_instance method is not functioning right?
Any help would be appreciated, Thanks
Alain