I've got Zend code which looks like this:
$contextSwitch->addActionContext('get', array('xml','json'))->initContext();
How can I change this so that it ONLY returns XML formatted data? SOrry, I'm new to Zend programming.!
I've got Zend code which looks like this:
$contextSwitch->addActionContext('get', array('xml','json'))->initContext();
How can I change this so that it ONLY returns XML formatted data? SOrry, I'm new to Zend programming.!
If you only ever use xml for a particular action, set the headers inside the action you want to return xml:
$this->getResponse()->setHeader('Content-type', 'text/xml');
And then process the rest of the action as you need it to. Without context switching enabled the view will be the default for the action (ie. actioname.phtml)
You will probably also want to disable your layout:
$this->_helper->layout->disableLayout();