Welcome Guest, Not a member yet? Register   Sign In
Can't select database using extended controller. regular controller works.
#4

[eluser]CroNiX[/eluser]
Are you using an autoloader? CI won't find anything that extends MY_Controller by default.

Try putting this at the very bottom of /application/config/constants.php
Code:
/*
| -------------------------------------------------------------------
|  Native Auto-load
| -------------------------------------------------------------------
|
| Nothing to do with cnfig/autoload.php, this allows PHP autoload to work
| for base controllers and some third-party libraries.
| http://philsturgeon.co.uk/blog/2010/02/CodeIgniter-Base-Classes-Keeping-it-DRY
|
*/
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;
        }
    }
}
and
MY_Controller.php and Common_Auth_Controller.php would both go in
/application/core

Any regular controllers that extend those go in the regular
/application/controllers dir


Messages In This Thread
Can't select database using extended controller. regular controller works. - by El Forum - 05-14-2012, 01:37 PM



Theme © iAndrew 2016 - Forum software by © MyBB