[eluser]Aquillyne[/eluser]
I seem to have recurring problems whereby I instantiate a library and try to use a function from it - but it just doesn't work. I mean, for instance:
The following is a hook of mine:
Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Sitesession extends Controller
{
function Sitesession()
{
parent::Controller();
$this->load->library("session");
}
function start()
{
$this->session->set_userdata("active", TRUE);
}
function destroy()
{
$this->session->unset_userdata("active");
}
}
?>
Which just doesn't work. I get 2 errors:
Quote:Undefined property: Sitesession::$session
Fatal error: Call to a member function set_userdata() on a non-object in C:\Server\Frameworks\CodeIgniter\application\hooks\sitesession.php on line 15
Why doesn't this work? I've tried calling the hook at all the different hook-points, but I get the same error. I've tried loading the library in the respective functions, and auto-loading it - still no luck.
Please help!