Get Custom Added Config Value in 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');

Related Posts

DOWNLOAD OUR APP AND NEVER MISS THE DAILY UPDATES

Get all the updates on your mobile. Participate in our giveaways and get exclusive deals and offers.

TechRounder App

Leave a Comment

Share via
Copy link
We would like to show you notifications for the latest offers and updates.
Dismiss
Allow Notifications