CodeIgniter Forums
Helpers nor the session class won't initiate... what am I doing wrong? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Helpers nor the session class won't initiate... what am I doing wrong? (/showthread.php?tid=18969)



Helpers nor the session class won't initiate... what am I doing wrong? - El Forum - 05-23-2009

[eluser]darren884[/eluser]
Here is my code:
Code:
<?php

class Admin extends Controller {

    function __construct() {
        $this->load->library('session');
        $this->load->helper('url');
        parent::Controller();
    }
    
    function index() {
        print_r($this->session);
        exit();
        if ( isset($this->session->userdata('logged_in')) && $this->session->userdata('level') == 'admin') {
        } else {
            redirect('login.html');
        }
    }
}

I am using PHP5 so it's not the __construct... I am new to code igniter... what am I doing wrong here?


Helpers nor the session class won't initiate... what am I doing wrong? - El Forum - 05-23-2009

[eluser]wiredesignz[/eluser]
Try calling the parent::Controller() constructor before you load your library/helper.


Helpers nor the session class won't initiate... what am I doing wrong? - El Forum - 05-23-2009

[eluser]darren884[/eluser]
Tried doesn't work, object is not initiated


Helpers nor the session class won't initiate... what am I doing wrong? - El Forum - 05-24-2009

[eluser]darren884[/eluser]
My bad it was my host I forgot I had to turn on PHP5