Zend Framework by mapping a URL extension to a format parameter?

Can I map a URL extension to a format parameter in ZF?

I want the default routing to start by default, including the display options from the URI, so you can say:

http://example.com/controller/action/param1/value1/param2/value2.json

Here: $this->_getParam('format') => "json"

And similarly:

http://example.com/module/controller/action/param1/value1/param2/value2.xml

Here: $this->_getParam('format') => "xml"

I was looking for default routes, but I can't get it to work.

+4
source share
1 answer

Can you create a regex route ending with something like (\ w +) (. (\ W +))? and grab the part after. like a grab .3. see Zend_Controller_Router_Route_Regex

+3
source

All Articles