Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set default context in Zend framework to XML

I'm using Zend framework, and most of the action controller that I have return XML response. In order to do this, I have to initialize context switching and provide URL suffix "?format=xml" to call each action.

Is there any way to make this default? So I don't have to add this suffix each URL?

Regards, Andree.

like image 302
Andree Avatar asked Dec 18 '25 18:12

Andree


1 Answers

EXTRA EXTRA.. READ ALL ABOUT IT!

http://framework.zend.com/manual/en/zend.controller.actionhelpers.html

Have a look at ContextSwitch and AjaxContext

(Edit) Suggest you use:

In some cases, you may want to force the context used; for instance, you may only want to allow the XML context if context switching is activated. You can do so by passing the context to initContext():

$contextSwitch->initContext('xml');

like image 83
Phliplip Avatar answered Dec 20 '25 08:12

Phliplip



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!