![]() |
Retrieving URL's from an includes file? - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: Retrieving URL's from an includes file? (/showthread.php?tid=43302) |
Retrieving URL's from an includes file? - El Forum - 07-07-2011 [eluser]TallowMan[/eluser] Hi All, Been using Codeigniter now for about a month, and I must say it's changed my world :-) After searching through the user manual and google, there is one thing I haven't been able to find an answer to though. Back in the dark days before codeigniter, I would have all my internal site URL's in an includes file, with URL variables assigned as such: $home_URL = "home.php", as a quick example. Therefore, saving me from hunting through the code if a URL had to change. Is there an MVC way of doing this, or a specific codeigniter way of doing this, or do I just call in an includes file as before, leading to "echo site_url($home)"? Thanks for taking the time to read. TallowMan Retrieving URL's from an includes file? - El Forum - 07-07-2011 [eluser]rogierb[/eluser] If you want to use an internal reference to a url, you could create a new config file and store your urls there. Then autoload that config and user the values. I rather use Routes see http://ellislab.com/codeigniter/user-guide/general/routing.html since that is the CI way of doing things. Not really what you asked though. Retrieving URL's from an includes file? - El Forum - 07-08-2011 [eluser]TallowMan[/eluser] I had a look at Routes, but wasn't sure it was exaclty what I was looking for. Maybe I just didn't understand it properly! But since you mentioned it, I'll have another look, as I would prefer to be doing things the 'CI way'. Cheers, TallowMan |