I am trying to get the routing information from a random URL (part of my application).
I tried to instantiate a Zend_Controller_Request_Http with an URL but it didn’t fill in the controller, module, action fields automatically.
I suppose it should somehow be linked to the Route info but cannot figure how to connect this.
Any leads?
Its not directly linked. What happens is the router calls its
routemethod passing the request as its argument. It then loops through all the registered routes in reverse order calling the route’smatchmethod with the request as an argument – if it matches it sets the parameters on the request before its returned.The problem is you cant directly call Zend_Controller_Router_Rewrite::route without modifying the current request cycle, so you have to rely on some “fudgery” or reproduce the logic in this method in your own ruter sbuclass or elsehwere.
Example of fudging:
I ran into problems with this down the line after i started getting into more complex request lifecyles. I dont remember why but i do remember my solution was to sub class the router and ad a method that
routethat looked something like this:Also keep in mind this is all from memory and it was with 1.6 or 1.7 not the current version so YMMV. Hope that helps.