I want to extend default CodeIgniter's class CI_Lang by creating a file /core/MY_Lang.php, and inside that file I need to load a custom configuration file:
class MY_Lang extends CI_Lang {
var $CI;
// Default langs
var $languages = array(
'en' => 'english',
'fr' => 'french'
);
public function __construct(){
parent::__construct();
global $CFG;
$this->CI =& get_instance(); // NOT WORKING
// Load custom config file from /config/languages.php
$this->languages = $this->CI->config->item('languages');
}
}
and /config/languages.php custom config file:
$config['languages'] = array(
'en' => 'english',
'fr' => 'french',
'ru' => 'russian',
'sk' => 'slovak'
);
Whenever I call for get_instance - I get an error telling me Fatal error: Class 'CI_Controller' not found in D:\wamp\www\ci2exp6\system\core\CodeIgniter.php on line 233
Please, could someone clarify what's wrong in my code ?