I will be shifting my code base to the new 2.0 framework and just had a few questions on the following points
My urls will be as follows
- example.in/city1
- example.in/city1/admin
- example.in/city2
- example.in/city2/admin
I would like to know what would be the best way to switch the database based on the city in the url? .
In my webroot i will have directories like city1, city2 each containing an index.php file which points to the single code base.
Now i only need a way to switch the database based on the url entered.
Regards,
Sheldon
I completely agree with @poelinca and @Ross, you should definitely consider rethinking your design.
however for reference issues this topic was already covered in the CodeIgniter forums pretty well over here
Basically you just configure another set of
$dbitems per connection and then request the connection based on those configuration parameters by the CodeIgniter framework, by providing the new$dbas a parameter for theDBclass constructor.