/** * @brief showPost 显示文章页面 * * @param $params 传入参数 * * @return void */ public function showPost($params) { $this->setPID($params['pid']); if ($params['pid'] == 0 || !$this->query()) { Response::error(404); } else { Widget::initWidget('Comment'); Widget::getWidget('Comment')->setPID($params['pid']); // TODO 由用户自定义 Widget::getWidget('Comment')->setPerPage(100); Widget::getWidget('Comment')->query(); // 阅读计数加一 $post = new PostLibrary(); $post->incView($params['pid']); // 设置标题、关键词、描述 Widget::getWidget('Global')->title = $this->postTitle(0, FALSE); Widget::getWidget('Global')->description = $this->postContent(60, TRUE, FALSE); Widget::getWidget('Global')->keywords = strip_tags(str_replace(' , ', ',', $this->postTags(FALSE))); $this->display('post.php'); } }
/** * @brief showPage 显示页面 * * @param $params 传入参数 * * @return void */ public function showPage($params) { Widget::initWidget('Post'); Widget::getWidget('Post')->setAlias($params['alias']); if (!Widget::getWidget('Post')->query()) { Response::error(404); } else { Widget::initWidget('Comment'); Widget::getWidget('Comment')->setAlias($params['alias']); // TODO 由用户自定义 Widget::getWidget('Comment')->setPerPage(100); Widget::getWidget('Comment')->query(); // 阅读计数加一 $post = new PostLibrary(); $post->incView($params['alias'], FALSE); // 设置标题、描述 Widget::getWidget('Global')->title = Widget::getWidget('Post')->postTitle(0, FALSE); Widget::getWidget('Global')->description = Widget::getWidget('Post')->postContent(60, TRUE, FALSE); $this->display('post.php'); } }