I created a core controller named Role_Admin and set the config prefix
$config['subclass_prefix'] = 'Role_';
Here is the code for the Role_Admin.php in the core folder
class Role_Admin extends CI_Controller {
function __construct() {
}
}
In the controller folder when I write
class admin extends Role_Admin { ... }
I get
Fatal error: Class 'Role_Admin' not found
Is something wrong in what I am doing.
edit: (i created a quick fix that is much better, any new core file that you create just extend the MY_Controller. Then in your controller directory you can extend any Core controller that you created
class MY_Controller extends CI_Controller {
function __construct() {
parent::__construct();
//include custom core classes
$core_path = DOCUMENT_ROOT . '/application/core';
$this->load->helper('file');
foreach(get_filenames($core_path) as $file) {
if ($file != 'MY_Controller.php') {
if(file_exists($file)) {
include_once($file);
}
}
}
}
}
Role_Admin.phpinapplication/core/and not insystem/core/, right ?