Choosing suffix depending on request
Hi,
I want to provide different views for my visitors, depending on their request.
Example request: "/example/help.json"
So the extension (".json") should be ignored for the dispatch, so that the request goes to ExampleController::helpAction() and "something" should set the suffix for my views and layouts to "json". The question is whats the best way, and is it possible? (using Router, preDispatch, modRewrite?)
I mean that's the whole sense of views, making it possible to switch them on-the-fly if another output type is requested (html, json, xml, pdf, txt, ..) but I couldn't figure out how to do that with Zend MVC. I don't want to use parameters here, because in my opinion a file extension is more intuitional and looks nicer.
Thanks in advance for any suggestion,
Chriz
|