CodeIgniter Forums
Extended Controller not working on App Engine - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: Extended Controller not working on App Engine (/showthread.php?tid=1310)



Extended Controller not working on App Engine - mr_pablo - 02-27-2015

In my CI 2.2 setup, I have MY_Controller extending CI_Controller, then Admin_Controller extend MY_Controller.

On LAMP/WAMP, this worked perfectly, using the following code in config.php to load the files

Code:
function __autoload($class)
{
    if (strpos($class, 'CI_') !== 0)
    {
        if (file_exists($file = APPPATH . 'core/' . $class . EXT))
        {
            include $file;
        }

        elseif (file_exists($file = APPPATH . 'libraries/' . $class . EXT))
        {
            include $file;
        }
    }
}

I have recently moved to using Googles App Engine and now I am having issues with getting the Admin_Controller to work. MY_Controller seems to load fine, no issues.

I even tried renaming the admin controller to MY_Admin_Controller, but that didn't help.

Any ideas?

EDIT - right, so I tried adding "include_once( APPPATH . 'core/Admin_Controller.php' );" to the autoload function. No luck. I then added it to the top of the admin index.php script, and it works. So, why isn't it being autoloaded?


RE: Extended Controller not working on App Engine - InsiteFX - 02-27-2015

Try putting your Admin_Controller class inside your MY_Controller class and see if it will work, that's how I do it.


RE: Extended Controller not working on App Engine - mr_pablo - 02-27-2015

So literally:

Code:
<?php
class MY_Controller extends CI_Controller
{
    public function __construct() {
        parent::__construct();
    }
}

class Admin_Controller extends MY_Controller
{
    public function __construct() {
        parent::__construct();
    }
}

?