Я новичок в CodeIgniter и следую одному премиальному руководству Nettuts по созданию CMS в codeigniter.
Самые первые мои каталоги application и system лежат по разным путям из public_html и задают путь в файле config.php.
Я создал два файла Frontend_Controller.php и Admin_Controller.php и в этих файлах создал класс, как показано ниже.
application/My_Controller.php
class MY_Controller extends CI_Controller
{
public $data = array();
function __construct()
{
parent::__construct();
$this->data['errors'] = array();
$this->data['site_name'] = config_item('site_name');
}
}
библиотеки/Frontend_Controller.php
class Frontend_Controller extends MY_Controller
{
function __construct()
{
parent::__construct();
}
}
библиотеки/Admin_Controller.php
class Admin_Controller extends MY_Controller
{
function __construct()
{
parent::__construct();
}
}
Теперь, когда я пытаюсь автоматически загрузить вышеуказанные классы, написав функцию __autoload() в файл config.php, но она не загружает файлы/классы
config.php
function __autoload($classname)
{
if(strpos($classname, 'CI_' !== 0))
{
$file = APPPATH . 'libraries/' . $classname . '.php';
if(file_exists($file) && is_file($file))
{
@include_once($file);
}
}
}
Может ли кто-нибудь помочь мне понять и решить проблему... Большое спасибо