You might be interested in using a case statement to streamline things. You should also be sure to check for HTTP_HOST first, since baking from the console wont have such a variable.
http://edwardawebb.com/programming/php-programming/cakephp/automatically-choose-database-connections-cakephp On Nov 19, 8:27 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > I have a local test server and a live site that I would like to use > the same exact codebase on. To automatically switch the config > settings in core.php I do something like this: > > if($_SERVER['HTTP_HOST'] == 'account.local') { > // Local > define('PATH_TO_WEBROOT', 'path/to/local/webroot/'); > define('ENABLE_EMAIL', false);} else { > > // Live > define('PATH_TO_WEBROOT', > '/path/on/live/servers/webroot/'); > define('ENABLE_EMAIL', true); > > } > > However, how do I do a similar thing with the DB settings? I'd like to > do something like this, but I don't know where to call it: > > if($_SERVER['HTTP_HOST'] == 'account.local') > $useDbConfig = 'test'; > > Thanks in advance! --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---
