I am trying to build a piece of application using cakephp; which will generate output in multiple formats (xml, json, custom, html).
Based on certain property, output format will be decided. What I want is, if html is output ype; then I want application to render view as usual (Regular Controller->render); else data should be rendered in other formats
Here is what I am trying to do. I have overridden function render in AppController.php as following -
public function render($view = null, $layout = null) {
if ($this->rType == "json") {
$this->_renderJson();
} else if ($this->rType == "xml") {
$this->_renderXml();
} else if ($this->rType == "custom") {
$this->_renderCustom();
} else {
parent::render($view,$layout);
}
}
This works perfectly with other formats but html.
I want call should be forwarded to Controller::render as normal cakephp flow would do. Instead it gives me below error
Error: Call to a member function send() on a non-object File: /xx/lib/Cake/Routing/Dispatcher.php Line: 174
Any thoughts - how can I resolve this ?