public function postDispatch(Yaf_Request_Abstract $request, Yaf_Response_Abstract $response) { # 得到 body 代码 $body = $response->getBody(); # 清理 body $response->clearBody(); # 使用 布局 $layout = new Yaf_View_Simple($this->_layoutDir); $layout->content = $body; /* if(false !== strpos(REDIRECT_URL, '/loan_')){ $loan = LoanModel::getInfoByUid($_SESSION['user']['uid']); if(empty($loan)){ $loan = array( 'loan_total' => 0, 'deposit_total' => 0, 'loan_over'=> 0, 'ybc_over' => 0, 'loan_lock'=> 0, 'ybc_lock' => 0 ); } $layout->assign('loan', $loan); } */ $layout->assign('layout', $this->_layoutVars); $response->setBody($layout->render($this->_layoutFile)); }
public function postDispatch(Yaf_Request_Abstract $request, Yaf_Response_Abstract $response) { /* get the body of the response */ $body = $response->getBody(); /*clear existing response*/ $response->clearBody(); /* wrap it in the layout */ $layout = new Yaf_View_Simple($this->_layoutDir); $layout->content = $body; $layout->assign('layout', $this->_layoutVars); /* set the response to use the wrapped version of the content */ $response->setBody($layout->render($this->_layoutFile)); }
public function postDispatch(Yaf_Request_Abstract $request, Yaf_Response_Abstract $response) { if (!Yaf_Registry::get("disableLayout")) { //获取已经设置响应的Body $body = $response->getBody(); //清除已经设置响应的body $response->clearBody(); $layout = new YoloYafView($this->_layoutDir); $layout->content = $body; //self::assign('companyInfo', UserApi::singleton()->getCompanyInfo(WZhaopinEnv::getCompanyWid())); $layout->assign('layout', self::$_layoutVars); //设置响应的body $response->setBody($layout->render((Yaf_Registry::get("setLayout") ? Yaf_Registry::get("setLayout") : $this->_layoutFile) . '.phtml')); } }