CodeIgniter Forums
Configure route using values from database? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Configure route using values from database? (/showthread.php?tid=21662)



Configure route using values from database? - El Forum - 08-17-2009

[eluser]vigna[/eluser]
Hi,
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

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

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?

Thanks


Configure route using values from database? - El Forum - 08-17-2009

[eluser]pistolPete[/eluser]
How about using the forum search?

http://ellislab.com/forums/viewthread/121486/
http://ellislab.com/forums/viewthread/90632/
http://ellislab.com/forums/viewthread/86097/
http://ellislab.com/forums/viewthread/96174/