[Solar-talk] constant in solar config array

Paul M Jones pmjones at ciaweb.net
Sat Oct 27 07:28:31 CDT 2007


On Oct 27, 2007, at 7:17 AM, Jeff Surgeson wrote:

> Hi All
>
> Can anyone give a reason why I should not use a constant in my  
> solar.config
> array, for example:
>
> if(DEBUG) {
>     $config['Solar']['ini_set']['display_errors']  = true;
>     $config['Solar_Sql_Adapter_Mysql']['host']  = '127.0.0.1';
> } else {
>     $config['Solar']['ini_set']['display_errors']  = false;
>     $config['Solar_Sql_Adapter_Mysql']['host']  = 'mysql- 
> db.jeff.co.za';
> }

No reason at all.  :-)  In fact, I do just that kind of thing  
myself.  Sometimes I even use this ...

     if ($_SERVER['SERVER_NAME'] == 'dev.example.com') {
         include "development.config.php";
     } else {
         include "production.config.php";
     }

... to make things *really* flexible.  Config files are scripts like  
anything else, so you should feel free to have normal PHP logic in  
them (as long as it's config-related logic).


--

Paul M. Jones  <http://paul-m-jones.com>

Solar: Simple Object Library and Application Repository
for PHP5.  <http://solarphp.com>

Join the Solar community wiki!  <http://solarphp.org>

Savant: The simple, elegant, and powerful solution for
templates in PHP.  <http://phpsavant.com>




More information about the Solar-talk mailing list