title: Codeigniter pre_system hook for DB driven dynamic controller selection - best approach?
body: <p>Although I can tentatively see a solution to this, I was wondering if there may be a glaringly obvious simpler approach.</p>
  
  <p>My aim is to use the first segment of a given URI to query the DB as to which controller should be run. </p>
  
  <p>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). </p>
  
  <p>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?</p>
  
  <p>Any better suggestions would be gladly received.</p>
  
  <p>Thanks.</p>