Get Custom Added Config Value in Codeigniter

no-input-file-error-codeigniter

In Codeigniter we can added any number of config variables for the site. Follow the step to add and retrieve the value of custom added config variable.

1. Define the config variables in config.php in ‘application/config’ folder

$config['config_variable1']	= 'Config value 1';
$config['config_variable2']	= 'Config value 2';
$config['config_variable3']	= 'Config value 3';

2. To get these values in the view files located in ‘application/views’

$config_variable1 = $this->config->item('config_variable1');
$config_variable2 = $this->config->item('config_variable2');
$config_variable3 = $this->config->item('config_variable3');
Previous Post

Create Android Native Menu in Phonegap

Next Post

Get the last executed Query in Codeigniter

View Comments (1)

Leave a Reply

Your email address will not be published. Required fields are marked *