CodeIgniter Forums
creating and using config values - Printable Version

+- CodeIgniter Forums (
+-- Forum: Using CodeIgniter (
+--- Forum: Best Practices (
+--- Thread: creating and using config values (/showthread.php?tid=1440)

creating and using config values - lhelber - 03-10-2015

We have a large CI app that is running but we need to make some global changes depending on the server and specific application we are running. One of the things I would like to do is setup a small selection of $config variables and use them to build other config variables so any changes we need to make only has to be in one place. An example: (in config directory)
$config['app_company'] = "New Company";
$config['app_name'] = 'testapp';
$config['app_domain'] = '';

$config['protocol'] = 'smtp';
$config['smtp_host'] = 'smtp.' . $config['app_domain'];

This works as long as it is in the config.php but doesn't if it is a seperate file. You can't use $this->config->item() call because in the config files you don't have an object defined.

Does anyone have a solution for this?

RE: creating and using config values - InsiteFX - 03-11-2015

Autoload the new config file and it will be added to the configuration.