I created this library:
class Header
{
function __construct()
{
$this->user();
}
function user()
{
$my_user = $this->session->userdata('my_user'); // True or False
if($my_user)
{
echo 'user!';
}
}
}
/* End of file Header.php */
I call it in any controller:
public function __construct()
{
parent::__construct();
$this->load->library('Header');
}
The error:
Fatal error: Call to a member function userdata() on a non-object in ** on line 11
I don't know what is the problem, I'm sure that the library session is called (I call it from autoload)... what can I do? When this library code is in any controller it works great, the problem is anywhere with custom library.