views:

52

answers:

1

Is there a built in method in Zend Framework to convert a REQUEST_URI to its route name?

I want to know if ZF dispatches my request to a route, what route is taken for that specific request.

For example, this is my routes.ini:

routes.about.route = ":lang/about-my-company"
routes.about.defaults.controller = index
routes.about.defaults.action = about

routes.contact.route = ":lang/contact"
routes.contact.defaults.controller = index
routes.contact.defaults.action = contactform

In this case: /en/about-my-company I want this as return value: about. Because that's the name of the route.

+1  A: 

Found the answer:

Zend_Controller_Front::getInstance()->getRouter()->getCurrentRouteName()