Codeigniter pre_system hook for DB driven dynamic controller selection - best approach?

Posted by Andy on Stack Overflow See other posts from Stack Overflow or by Andy
Published on 2010-05-21T21:47:02Z Indexed on 2010/05/21 21:50 UTC
Read the original article Hit count: 209

Filed under:
|
|

Although I can tentatively see a solution to this, I was wondering if there may be a glaringly obvious simpler approach.

My aim is to use the first segment of a given URI to query the DB as to which controller should be run.

I assume I would have to reform the URI with the resultant controller name in segment 1, then allow the system to continue processing as normal (hence a pre_system hook).

Although not essential I would also like to hold a couple of other variables from the same DB request to be used later in the call stack, and assume this would have to be done using global variables?

Any better suggestions would be gladly received.

Thanks.

© Stack Overflow or respective owner

Related posts about codeigniter

Related posts about hooks