[eluser]The Casual Bot[/eluser]
not sure what I'm looking for with MY_controller
but i have worked how to get this working what i did is
Created a library
then auto loaded it so now every time A page loads it checks the db for unread msg's and updates the session
Mymsglib
Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Mymsglib {
function Mymsglib()
{
$CI =& get_instance();
$CI->load->library('session');
$session = $CI->session->userdata('userid');
if (!empty($session)) { //check to see if user is logged in
$CI->load->model('msg_model');
$unread = array();
$unread['unreadmsg']= $CI->msg_model->unread();
$CI->session->set_userdata($unread);
}
}
}
?>
autoload
Code:
$autoload['libraries'] = array('database', 'session', 'mymsglib');
and my sidebar view
Code:
<?=$this->session->userdata('unreadmsg')?>
but im still intrigued by My_Controller could you expand on this a little for me plz :-)