Welcome Guest, Not a member yet? Register   Sign In
Problem when extending the controller
#1

[eluser]fatman[/eluser]
Hi all,

I'm using CI 1.7.2. I've added my_controller.php under application/libraries

Code:
class MY_controller extends Controller {
    function __construct() {
        parent::__construct ();
        
        $is_logged_in = $this->session->userdata ( 'is_logged_in' );
        if (! isset ( $is_logged_in ) || $is_logged_in != true) {
            $message = "You must <a href='".base_url()."'>login</a> in order to see this page";
            show_error ($message);
        }
    }
}

All my controllers extend this one:

Code:
class Main extends MY_controller
{
    function __construct()
    {
        parent::__construct();
    }
}

It all works perfectly on WIN7/XAMPP but when deploying it on Ubuntu I get an error stating that MY_controller could not be found.

I've been banging my head on this for quite some time PLEASE HELP!!!

Thanks,
#2

[eluser]John_Betong[/eluser]
Ubuntu is case sensitive.

Try saving the file as MY_Controller.php and extending MY_Controller.
&nbsp;
&nbsp;
&nbsp;
#3

[eluser]fatman[/eluser]
Problem solved, Thanks man, i've spent hours on this!
#4

[eluser]John_Betong[/eluser]
>>> Problem solved, Thanks man, i’ve spent hours on this!

Glad I was able to help, I already have the tshirt Smile
&nbsp;
Beware of your controllers that require case-sensitive class names but lower-case file names.
&nbsp;
&nbsp;




Theme © iAndrew 2016 - Forum software by © MyBB