CodeIgniter Forums
Loading/accessing a model from within routes config - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: Loading/accessing a model from within routes config (/thread-8470.html)



Loading/accessing a model from within routes config - El Forum - 05-19-2008

[eluser]Daniel H[/eluser]
I want to dynamically create routes for a series of sections in a db table, which will simply route through to a page controller identified by their respective numeric id.

However I can't imagine there's an easy way to load and use a model in the routes config file, or at least I haven't been able to, such that I can dynamically generate these routes.

Has anyone tried something similar?

Thanks.


Loading/accessing a model from within routes config - El Forum - 05-26-2008

[eluser]Unknown[/eluser]
I'm trying to do the same thing, is there an alternative way to accomplish this goal? If not, is it possible to use the database class or a model in the routes.php, or is there a way to dynamically modify this config variable?


Loading/accessing a model from within routes config - El Forum - 05-26-2008

[eluser]frenzal[/eluser]
I include a file inmy routes.php, the contents of that file is generated from the db but is only written to on occasion so it's not 100% dnyamic. If i remember correctly there is no easy way to do this as the routing is called before any database is loaded