I have a requirement to connect to different databases depending on a given condition. The condition can be encoded as a part of the URL. I want to use the same CMS code, same template, same page types, etc.; but to connect to a different database.
the best way (and safest) is to use GET variables. As the URL parser has special order eg yoursite.com/ClassName/Action/ID so if you did yoursite.com/fruit/ it would first look for the Page with a url of fruit, then second a class called fruit. But you would probably want to set the DB on a bunch of situations.. So I would suggest have yoursite.com/?d=fruit then in the _config you can do if isset($_GET['d']) $database = ? etc.