Ahh lovely! That works perfect. Still not sure what was causing the
problem I've been discussing but it doesn't matter for the time being.

Get that blogged! Or I'll do it :)

On Jul 14, 11:31 am, Jon Bennett <jmbenn...@gmail.com> wrote:
> hi Alastair,
>
>
>
>
>
> > Here's the content of my database.php file. Nothing out of the
> > ordinary here?
>
> > class DATABASE_CONFIG {
>
> >        var $default = array(
> >                'driver' => 'mysql',
> >                'persistent' => false,
> >                'host' => 'localhost',
> >                'login' => 'XXXXX',
> >                'password' => 'XXXXX',
> >                'database' => 'landscaper',
> >                'prefix' => '',
> >        );
>
> >        var $production = array(
> >                'driver' => 'mysql',
> >                'persistent' => false,
> >                'host' => 'localhost',
> >                'login' => 'XXXXX',
> >                'password' => 'XXXXX',
> >                'database' => 'landscaper',
> >                'prefix' => '',
> >        );
>
> > }
>
> Another option (this is what I do) would be to have just one db config
> called default, but define the class in a switch statement that's
> checking the HTTP_HOST.
>
> <?php
>
> switch (env('HTTP_HOST')) {
>         // Local/dev version
>         case 'local.domain.com':
>         case '127.0.0.1':
>                 class DATABASE_CONFIG {
>                        var $default = array(
>                                'driver' => 'mysql',
>                                'persistent' => false,
>                                'host' => 'localhost',
>                                'login' => 'XXXXX',
>                                'password' => 'XXXXX',
>                                'database' => 'landscaper',
>                                'prefix' => '',
>                        );
>                 }
>                 break;
>         // Live
>         default:
>                 class DATABASE_CONFIG {
>                        var $default = array(
>                                'driver' => 'mysql',
>                                'persistent' => false,
>                                'host' => 'localhost',
>                                'login' => 'XXXXX',
>                                'password' => 'XXXXX',
>                                'database' => 'landscaper',
>                                'prefix' => '',
>                        );
>                 break;
>
> }
>
> ?>
>
> I use this same technique to turn on/off debug, caching etc, means one
> set of app files can be SVNd to different environments without
> changes.
>
> Been meaning to blog about it, will try to soon.
>
> hth
>
> jon
>
> --
>
> jon bennett
> w:http://www.jben.net/
> iChat (AIM): jbendotnet Skype: jon-bennett
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to