Welcome Guest, Not a member yet? Register   Sign In
General problems regards loading libraries, and hooks
#1

[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!


Messages In This Thread
General problems regards loading libraries, and hooks - by El Forum - 06-08-2008, 04:12 PM
General problems regards loading libraries, and hooks - by El Forum - 06-08-2008, 05:26 PM
General problems regards loading libraries, and hooks - by El Forum - 06-09-2008, 06:18 AM
General problems regards loading libraries, and hooks - by El Forum - 06-09-2008, 07:37 AM
General problems regards loading libraries, and hooks - by El Forum - 06-09-2008, 11:46 AM
General problems regards loading libraries, and hooks - by El Forum - 06-09-2008, 12:45 PM



Theme © iAndrew 2016 - Forum software by © MyBB