[eluser]griffithtp[/eluser]
[quote author="Wogan" date="1227060956"]Thanks, but after using the word "hook", I thought there might be an easier way. Turns out there was.
In config/config.php, set $config[enable_hooks] = TRUE (line 91). Then in config/hooks.php, I added:
Code:
$hook['post_controller'] = array(
'class' => 'Customhooks',
'function' => 'global_footer',
'filename' => 'Customhooks.php',
'filepath' => 'hooks',
'params' => ''
);
Then in application/hooks, I created Customhooks.php, with the following code:
Code:
class Customhooks extends Controller
{
function global_footer()
{
$this->load->view('global_footer');
}
}
And bingo. It worked
[/quote]
This is great and works!
HOWEVER, it doesn't load libraries anymore.
Code:
$this->session->userdata('logged_user');
or
Code:
$this->load->library('userlib');
$this->userlib->getdetails();
If userlib is loaded in the autoload, it then works. BUT session is also loaded in autoload.php and still doesn't recognise $this->session as it seems it isn't loaded.
Code:
$this->session->userdata('logged_user'); //<--- this is called in the header hook..