Extending CodeIgniter core classes Extending CodeIgniter core classes codeigniter codeigniter

Extending CodeIgniter core classes


to allow any new class . means which class are note defined in system/core solution could be as follow.

Try putting below function at the bottom of config file

/application/config/config.phpfunction __autoload($class) {    if(strpos($class, 'CI_') !== 0)    {        @include_once( APPPATH . 'core/'. $class . '.php' );    } }

My core class My_head not found in codeigniter


Here is a good explanation as to why you can't do it the way you have described. Essentially CodeIgniter looks for ['subclass_prefix'] . $Classname, e.g. 'MY_' . 'Controller'. And here is the same question for CI2

Solution:
Put both MY_Controller and MY_AdminController in MY_Controller.php

MY_Controller.php

class MY_Controller extends CI_Controller {    public function __construct() {        parent::__construct();    }    ...}class MY_AdminController extends CI_Controller {    public function __construct() {        parent::__construct();    }    ...}