[eluser]beeLoop[/eluser]
[quote author="PhilTem" date="1350047105"]Nope, it's not possible to perform database queries in routes.php since the database library wasn't loaded at the time the routes are being read. However, you can route all your requests through a bootstrap-controller just like @alexwenzel suggested. But you need to be careful with extending CI_Controller in that case since you will get problems with the CI-singleton (which will no longer be a singleton but a doubleton (or whatever the real name for it is)).
You can have a look here
http://files.ignitedco.de/codeigniter/tu...uting.html
I wrote a little tutorial on how to achieve what you want. Please be aware it's not tested and just written off the top of my head and it does not support controllers in sub-directories. However it should give you a hint to what the second example looks like.
To add: I recommend using the second example only if you will have a load of dynamic pages, otherwise you should honestly go with the first example by @alexwenzel.
PS: You may of course also do some looping over the files found in APPPATH . 'controllers/' and add those manually to a big string like
Code:
$routes['(big|list|of|controllers|found|in|folder|APPPATHcontrollers)'] = $1;
$routes[(:any)] = 'bootstrap/route';
which will route example.com/big, example.com/list, ..., example.com/APPPATHcontrollers to the respective controller and everything else to your bootstrap/dynamic-pages controller.[/quote]
About requests through a bootstrap-controller, i need to dig a bit regarding this, as i need to exactly understand what i will be implementing in my project. But the idea to request through bootstrap-controllers seems interesting to me.