Welcome Guest, Not a member yet? Register   Sign In
Configure route using values from database?

Is it possible to load a model in the routes.php file?

The reason is, I want to use the existing values in the database and create a routes configuration. It's a CMS website. And I have got the link (http://www.example.com/aboutus) something like this. I have a table pages and fields such as title, content, meta_keywords, link_text etc... In the link_text field I store text such as contact_us, about_us etc..

I want to form something like

foreach ($pages as $page):
   $route[$pages->link_text] =   $route[pages/view/$pages->link_text];

so if I call
http://www.example.com/aboutus or http://www.example.com/terms
the pages controller, view function should be called.

I cannot figure it out how to get the table contents in the route.php file?
Please let me know am I trying it in the right way?


Theme © iAndrew 2016 - Forum software by © MyBB