Welcome Guest, Not a member yet? Register   Sign In
Using Hooks to select Database
#1

[eluser]faceh[/eluser]
I am creating a code base where many different domain names will point to the same codeigniter installation, each having their own SQL database.

I want to use Hooks (or any other appropriate method) to select which SQL Database to use. My first thought is to use a pre_controller hook to grab the domain name using $_SERVER[http_host], and then use this to determine which client it is. The problem is passing this information from the hook to the database file, as the db file only uses local variables.

Any thoughts?
#2

[eluser]sophistry[/eluser]
is this new Events contribution of any use?

http://ellislab.com/forums/viewthread/69753/
#3

[eluser]faceh[/eluser]
looks pretty interesting, but on further messing around i managed to avoid Hooks altogether. Instead I'm loading the database library manually and grabbing the settings on the fly. Lot nicer than hacking the core, etc.

Thanks for your help anyway, I might use it in the future.




Theme © iAndrew 2016 - Forum software by © MyBB