![]() |
Database driven routes in CodeIgniter - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22) +--- Thread: Database driven routes in CodeIgniter (/showthread.php?tid=20098) Pages:
1
2
|
Database driven routes in CodeIgniter - El Forum - 05-15-2010 [eluser]neillyons.co[/eluser] @clooner Not sure if you arrived at this forum topic directly or through my more recent post. There I talk about including a cache file in the routes.php file similar to what your describing. Although the cache file is not created when you access a certain controller but whenever an insert/update/delete operation is performed on the route model. With your solution I think there might be an issue with lag time. For example, say I have just created an article on my website. It has CodeIgniter's default route of articles/get/1 and an alias of that route like so articles/my-example-article. I'm assuming your updating your cache file on a cron once a day. So the time between the article being created and the cron being run that route (articles/my-example-article) will produce a 404 error. Does that make sense? Database driven routes in CodeIgniter - El Forum - 05-19-2010 [eluser]Unknown[/eluser] Hello, I am using this piece of code and I want to extend it. But I need now a config variable in the Router_Hook.php. To do this, I thought I do the same as with the database variables: So in the hook.php file I added the following: Code: require_once BASEPATH."application/config/config.php"; if I do for example: Code: echo $config['base_url']; What is going wrong? (I'm new to CodeIngiter) Thanks, Kristof Database driven routes in CodeIgniter - El Forum - 05-20-2010 [eluser]neillyons.co[/eluser] @Kristof Mariƫn there's a function to access configuration variables stored in the config.php file. Code: $base_url = config_item("base_url"); Then if you want to print it out: Code: print $base_url; You can also get the entire config array using: Code: $config = get_config(); And print it out like so: Code: print $config["base_url"]; |