All of the pages and resources that php will give through readfile() exist in a database table entities. The entities table includes the uri alias for the object, what type of object it is so it can properly route it. Should I just include it in application/config/routes.php, should I write some helper functions and include them in the application/config/routes.php?
Should I put this elsewhere?
example:
URI:
index.php/about-us
SQL:
SELECT *
FROM entities
WHERE alias LIKE ?
RESULT:
array(
[id]=>5
[alias]=>'about-us'
[type]=>'page'
ROUTE:
"page/get_page/$1"
What I would recommend is that you subclass CodeIgniter’s router (discussed here: CodeIgniter System Subclassing), and make your calls in there. This way you keep your routes in your routes config, and your routes logic in the router class.
This way you’ll be able to put whatever routing related functions that are necessary in the same class, as well.