I'm using hooks to call a Class that is executed before controllers are called.
$hook['pre_controller'] = array(
'class' => 'CargarInformacion',
'function' => 'obtenerInfo',
'filename' => 'CargarInformacion.php',
'filepath' => 'hooks',
'params' => ''
);
This is the class
class CargarInformacion
{
function obtenerInfo()
{
$ci = &get_instance();
$informacion = $ci->db->get('sitio', 1)->row();
}
}
But I always get the same error
Trying to get property of non-object
I know there are thousands of answers realated but until now I haven't found the right one.