CodeIgniter Forums
Access config.php settings in email.php? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Access config.php settings in email.php? (/showthread.php?tid=36616)



Access config.php settings in email.php? - El Forum - 12-08-2010

[eluser]hailwood[/eluser]
Hi there,

I have two config files.

config.php (code igniters core config)

and email.php (autoloaded by the email class when it is used)

What i am wanting to do is.

In config.php have
Code:
$config['env'] = 'hailwood_dev';

then in email.php have
Code:
if($config['env'] == 'hailwood_dev'){
    //email variables like smtp server to do with localhost
    } elseif($config['env'] == 'production'){
    //email variables like smtp server to do with production
    }
But this is not having any effect (im guessing as $config['env'] does not have those values).

How can I access this value?


Access config.php settings in email.php? - El Forum - 12-08-2010

[eluser]pickupman[/eluser]
PHP commands still work, so you could try at the top of your email.php
Code:
include_once('config.php');