public function postDispatch(\Yaf\Request_Abstract $request, \Yaf\Response_Abstract $response) { $body = $response->getBody(); $response->clearBody(); $layout = new Yaf\View\Simple($this->_layoutDir); $layout->content = $body; $layout->base_url = ''; $layout->assign('layout', $this->_layoutVars); $response->setBody($layout->render($this->_layoutFile)); }
/** * * @param \Yaf\Request_Abstract $request * @param \Yaf\Response_Abstract $response */ public function postDispatch(Request $request, Response $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)); }
/** * 消息页面 * * @param string $message * @param string $url * @param integer $time * @param string $template * */ public static function displayMessage($message, $url = '', $time = 3, $template = 'error/message.php') { $request = new \Yaf\Request\Simple(); if (empty($url)) { $url = $request->getServer()['HTTP_REFERER']; } $view = new \Yaf\View\Simple($request); $view->setScriptPath(\Yaf\Registry::get('config')->application->view->path); $view->assign('message', \Yaf\Registry::get('lang')->translate($message)); $view->assign('url', $url); $view->assign('time', $time); $view->display($template); exit; }
private function renderDefault($file, $data) { $view = new \Yaf\View\Simple($this->path); return $view->render($file, $data); }