I have various controller is core/
folder named core/my_controller.php
and other controllers in libraries/
folder as libraries/user_controller.php
,libraries/frontend_controller.php
. Now I am using this code below in config.php
to autoload these files. But I dont think its working.
I am seeing this error message Fatal error: Class 'MY_Controller' not found in /home/manumakeadmin/manumake.com/2d/application/libraries/frontend_controller.php on line 3
function __autoload($classname) {
if (strpos($classname, 'CI_') !== 0) {
$file = APPPATH . 'libraries/' . $classname . '.php';
if (file_exists($file) && is_file($file)) {
@include_once($file);
}
}
}
EDIT
I can make it work by manually including the files as
<?php
include_once APPPATH.'core/my_controller.php';
class Frontend_controller extends MY_Controller
{
But I was wondering if I could make the autoload code to work