_view = $view; $this->_templateDirectory = $templateDirectory; } public function dispatchLoopStartup(Zend_Controller_Request_Abstract $request) { // set default variables for this template so E-NOTICE doesnt complain $this->_view->user = Zend_Auth::getInstance()->getIdentity(); $this->_view->allowed_templates = array(); $this->_view->javascripts = array(); $this->_view->styles = array(); $this->_view->styles_conditionals = array(); $this->_view->dojodebug = false; $this->_view->dojoinits = array(); $this->_view->dojowidgetids = array(); $this->_view->dojorequires = array(); $this->_view->dojostyles = array(); } public function dispatchLoopShutdown() { $view_template = $this->getRequest()->getParam('template', 'main'); // view param from url $view_template = ( ($view_template != 'main') && (in_array($view_template, $this->_view->allowed_templates)) ) ? $view_template : 'main'; // get flash messages & pass to view $messenger = new FlashMessenger(); $this->_view->messages = $messenger->getMessages(); $this->_view->content = $this->_response->getBody(); // set since this is our last usage of view $this->_view->setScriptPath($this->_templateDirectory); try { switch ($view_template) { case 'json': $this->_response->setHeader('content-type', 'text/x-json'); break; case 'dialog': $this->_response->setBody($this->_view->render('dialog.phtml')); break; default: $this->_response->setBody($this->_view->render('main.phtml')); break; } } catch (Exception $e) { die($e->getMessage()); } return; } }