How we can use language file inside config.php php codeigniter? I searched to find solution just from out side the config we can set item in config to use language file for setting config item value, but how we can set config item using language file inside config file? for example i want to do as bellow:
$config['item'] = array(
'1' => $ci->lang->line('my_name')
);
You use wrong way. You try make view function in config file. You can make this in template or may be in model.
You should change your application architecture.
you can't access ci
object in config file because this is load before CI_Loader
class. but you can update config.php
field later on run time, using $this->config->set_item('key', 'value');
function in controller/model/library
sample code in controller __construct(){}
method
public function __construct(){
$this->config->set_item('item', array('1' => $this->lang->line('my_name')));
}
Another way use hooks to update item globally, more detail available on CI documentation.