codeigniter: access config variables from other config files?
I checked and at that point in the request lifecycle the config property of the CodeIgniter object is just an array, not a config object.
So you should be able to get at your configuration setting like this :
$this->config['env']
So this should work :
if ($this->config['env'] == 'hailwood_dev'){ //email variables like smtp server to do with localhost} elseif ($this->config['env'] == 'production'){ //email variables like smtp server to do with production}
If you are autoloading configuration files, make sure they are autoloaded in the correct order. A configuration file must be autoloaded after any it depends on.
Add this to your email config file.
$environment = config_item('env');OR THIS$environment = $this->config->item('env');
Not sure if the first will work on your setup. Most people seem to use the second.
Try this:
$env = $this->config->item('env'); if ($env == "dev_server") { // Do this... } else { // Do this.. }