/** * 设置图表的布局页面和视图页面 * * @see Zend_Controller_Action_Helper_Abstract::preDispatch() */ public function postDispatch() { $request = $this->getRequest(); if ($request->has('chart') && !$this->_inErrorHandler()) { $action = $request->getActionName(); try { $this->_actionController->render($action . 'Chart' . ucfirst($request->getParam('chart'))); Zend_Layout::getMvcInstance()->setLayout('chart'); ZtChart_Plugin_Layout::resetModuleLayout(); } catch (Zend_View_Exception $e) { $this->_actionController->render($action); } // 是否需要以JSONP格式返回数据 if ($request->has('callback')) { $response = $this->getResponse(); $jsonp = $request->getParam('callback') . '(' . $response->getBody() . ')'; $response->setBody($jsonp); } } }