I did a lot of search for my problem but I did not get anything ..
in codeigniter when I use config files I do that :
my_config.php :
$config['my_title'] = ' My Title Here ' ;
$config['color'] = ' red ' ;
I can retrieve it like this :
$this->load->config('my_config', TRUE );
$data['my_title'] = $this->config->item('my_title', 'my_config');
My question is : How can I get the full array to deal with it ?
I want the $config as an array to do something like this :
foreach($config as $key=>$val){
$data[$key] = $val ;
}
so I do not have to write all my variables that in config file like this :
$data['my_title'] = $this->config->item('my_title', 'my_config');
$data['color'] = $this->config->item('color', 'my_config');
and so on ..
sorry for my broken English !
thanks in advance ;)
While this is undocumented, and might break in future releases, you can access the main config array by:
$config = $this->config->config;
$config=$this->load->config('my_config', TRUE );
$config = $this->config;
$my_config=$config->config['my_config'];
echo"<pre>";print_r($my_config);
It may help you..
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With