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');
Vipin is a Programmer who loves blogging and used to do research on new things. He loves to share those information through this blog. You can contact him via email [email protected]