• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
creating and using config values

#1
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.php
$config['app_company'] = "New Company";
$config['app_name'] = 'testapp';
$config['app_domain'] = 'newcompany.com';

email.php
$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?
Reply

#2
Autoload the new config file and it will be added to the configuration.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.