I have an action in the controller that should display different types of output depending on the value in the form drop-down list.
I wrote a Templater object (extends from Zend_View_Abstract) for different types of views.
I tried running the following code:
public function generateDocumentAction() { //...some code to set $view depending on post data // eg $view = new TemplaterOdt(); //view as an OpenOffice document $this->_helpers->getHelper('viewRenderer')->setView($view); $this->view->myvar = $form->getValue('some_value'); }
but $this->view is still standard (Smarty templater), which is installed in /public/index.php
I looked through the documentation and it says that you can set the view in the init () function in the controller http://framework.zend.com/manual/en/zend.view.scripts.html but that would set the view for the whole controller, which I do not want.
How can I change the type of output for this action only?
source share