Welcome Guest, Not a member yet? Register   Sign In
Extending another core class
#1

Code:
class Settings extends USER_Controller {...}

class USER_Controller extends MY_Controller {...}//limit access to user and define some params and functions that is user depended

class MY_Controller extends CI_Controller {...}//provide extra functionality accross all controllers

well if i try to create above 3 class's this will not work.

yet if i just use settings extends MY_Controller it will work fine.

so is there a way i can put a middle class between my controller and MY_Controller -the base controller that extends CI_Controller ?

In CI2.2 I was using function below inside config.php but on CI 3.0 I get errors.

Code:
function __autoload($class){
    if (substr($class,0,3) !== ‘CI_’) {
        $file = APPPATH . ‘core/’ . $class . EXT;
        if (file_exists($file)) {
        include $file;
        }
    }
}
Reply
#2

I found the solution. This code works fine.
I realised, the EXT constant has been removed on CI3

Code:
function __autoload($class){
    if (substr($class,0,3) !== ‘CI_’) {
        $file = APPPATH . ‘core/’ . $class .'.php';
        if (file_exists($file)) {
        include $file;
        }
    }
}
Reply




Theme © iAndrew 2016 - Forum software by © MyBB