Welcome Guest, Not a member yet? Register   Sign In
Access "routes.php" from Helper, Library or Controller
#1

[eluser]Unknown[/eluser]
So, I am looking to build a SiteMap from the routes files.

I have found the SiteMap "plugin" or what have you (http://codeigniter.com/wiki/Sitemap/) which works well enough, but I want to be able to stack track the Controller and Method to the route assigned to them.

Simple enough in theory (as I have the array value, and can reverse to its key (ie. the route)), but I don't know how to gain access to the Routes array as defined in "routes.php".

Is this even possible?
#2

[eluser]Johnny Freeman[/eluser]
Welcome to the forums k386!

There is no built-in function/method of getting the routes array. You can, however, use the file() method in the [email=http://ellislab.com/codeigniter/user-guide/libraries/loader.html]Loader library[/email] to 'load' the routes.php file. Once you've done so, you should have access to the $route array.




Theme © iAndrew 2016 - Forum software by © MyBB