Welcome Guest, Not a member yet? Register   Sign In
Route using database information
#3

[eluser]Colin Williams[/eluser]
If you trace through CI bootstrapping, you quickly realize that there's no way to access the DB in the Router class. Well, you can, but you inevitably end up with two database connections. The only way around it is to rewrite the bootstrapping process so that the database libraries are available right away (and this involves changing a lot of processes down the line, like, you would have to redo how the db class gets referenced to the CI object so your can do $this->db still).

It's not impossible, but you can't do it without significantly changing core, or living with two DB connections per request.

What I've done is have the config/routes.php file dynamically written to based on values in the database. This seems to work best without modifying CI extensively.


Messages In This Thread
Route using database information - by El Forum - 11-06-2008, 10:49 AM
Route using database information - by El Forum - 11-06-2008, 02:43 PM
Route using database information - by El Forum - 11-06-2008, 03:13 PM
Route using database information - by El Forum - 11-06-2008, 04:20 PM
Route using database information - by El Forum - 11-06-2008, 04:32 PM
Route using database information - by El Forum - 11-06-2008, 04:58 PM
Route using database information - by El Forum - 11-06-2008, 04:59 PM
Route using database information - by El Forum - 11-06-2008, 05:01 PM
Route using database information - by El Forum - 11-06-2008, 05:02 PM
Route using database information - by El Forum - 11-06-2008, 05:29 PM
Route using database information - by El Forum - 11-06-2008, 05:33 PM
Route using database information - by El Forum - 11-06-2008, 05:48 PM
Route using database information - by El Forum - 11-06-2008, 05:48 PM
Route using database information - by El Forum - 11-06-2008, 05:51 PM
Route using database information - by El Forum - 11-06-2008, 05:55 PM
Route using database information - by El Forum - 11-06-2008, 06:04 PM
Route using database information - by El Forum - 11-06-2008, 06:08 PM
Route using database information - by El Forum - 11-06-2008, 06:11 PM
Route using database information - by El Forum - 11-06-2008, 06:21 PM
Route using database information - by El Forum - 11-06-2008, 06:32 PM
Route using database information - by El Forum - 11-06-2008, 06:46 PM
Route using database information - by El Forum - 11-06-2008, 06:57 PM
Route using database information - by El Forum - 11-07-2008, 04:27 AM
Route using database information - by El Forum - 11-07-2008, 01:46 PM
Route using database information - by El Forum - 01-28-2009, 05:13 PM
Route using database information - by El Forum - 02-06-2009, 12:31 AM
Route using database information - by El Forum - 05-13-2009, 02:33 AM
Route using database information - by El Forum - 05-13-2009, 03:14 AM
Route using database information - by El Forum - 05-13-2009, 03:24 AM
Route using database information - by El Forum - 05-14-2009, 03:54 AM
Route using database information - by El Forum - 05-26-2009, 10:06 AM
Route using database information - by El Forum - 05-27-2009, 03:13 AM
Route using database information - by El Forum - 05-27-2009, 04:20 AM



Theme © iAndrew 2016 - Forum software by © MyBB