Exemplo n.º 1
0
 public function doDefault(LJL_Request $input, LJL_Response $output)
 {
     //http://hongbo.com/index.php?c=detail&a=default&articleid=67
     LJL_Http::setExpires(3600);
     #设置缓存时间
     $articleId = $input->get('articleid');
     $articleInfo = Helper_Blog::getArticleInfo(array('articleId' => $articleId, 'fileds' => array('firstImgId', 'cate', 'title', 'descript', 'tags', 'source', 'insertTime', 'view', 'content')));
     if (count($articleInfo) < 5) {
         LJL_Http::send404Header();
         $output->setTemplate('404');
         return;
     }
     $articleInfo['id'] = $articleId;
     $articleTags = explode(',', $articleInfo['tags']);
     $cateList = LJL_Config::get('Blog_' . ucfirst(APP_BLOG_NAME) . '_Cate', 'CATE');
     $prevNext = Helper_Blog::getPreNextArticle(array('articleId' => $articleId, 'fileds' => array('id', 'title')));
     $prevNext = $this->formatPrevNext($prevNext);
     //面包屑导航
     $nav[0]['title'] = '首页';
     $nav[0]['url'] = WWW_WEB;
     $nav[1]['title'] = $cateList[$articleInfo['cate']][0];
     $nav[1]['url'] = Blog_Plugin_Urls::getListUrl(array('cate' => $articleInfo['cate']));
     $nav[2]['title'] = $articleInfo['title'];
     //seo
     $output->seoArr = array('title' => $articleInfo['title'] . ' - ' . BLOG_SEO_TITTLE . ' | 最红博', 'description' => $articleInfo['descript'], 'keywords' => implode(',', $articleTags));
     $output->cateList = $cateList;
     $output->articleInfo = $articleInfo;
     $output->articleTags = $articleTags;
     $output->prevNext = $prevNext;
     $output->nav = $nav;
     $output->cate = $articleInfo['cate'];
     $output->header = $output->fetchCol("Part/Main/Header");
     $output->footer = $output->fetchCol("Part/Main/Footer");
     $output->navbarTpl = $output->fetchCol("Part/Navbar");
     $output->leftsideCate = $output->fetchCol("Part/LeftsideCate");
     $output->navGuideTpl = $output->fetchCol("Part/Navguide");
     $output->newArticleTpl = $output->fetchCol("Part/NewArticle");
     $output->commentTpl = $output->fetchCol("Part/Comment");
     $output->searchTpl = $output->fetchCol("Part/Search");
     $output->setTemplate('Detail');
 }
Exemplo n.º 2
0
 public function doShowerror(LJL_Request $input, LJL_Response $output)
 {
     LJL_Http::send404Header();
     $output->setTemplate('404');
 }
Exemplo n.º 3
0
 public function doDefault(LJL_Request $input, LJL_Response $output)
 {
     //http://cuihongbo.com/index.php?c=list&a=default&cate=php
     //http://cuihongbo.com/index.php?c=list&a=default&cate=php&tag=%E5%AE%89%E5%85%A8%E9%97%AE%E9%A2%98
     LJL_Http::setExpires(3600);
     #设置缓存时间
     $page = $input->get('page') ? intval($input->get('page')) : 1;
     $cate = $input->get('cate');
     //与搜索标签方法融合
     $tag = $input->get('tag') ? urldecode(trim($input->get('tag'))) : urldecode(trim($input->get('keyword')));
     $cateList = LJL_Config::get('Blog_' . ucfirst(APP_BLOG_NAME) . '_Cate', 'CATE');
     //文章列表
     $articleList = Helper_Blog::getArticleList(array('page' => $page, 'pageSize' => $this->pageSize, 'fields' => array('id', 'firstImgId', 'title', 'descript'), 'cate' => $cate, 'tag' => $tag));
     //var_dump(1111);die;
     $articleCount = Helper_Blog::getArticleList(array('isCount' => 1, 'cate' => $cate, 'tag' => $tag));
     //分页相关
     $totalPage = ceil($articleCount / $this->pageSize);
     if ($page > $totalPage && $page > 1) {
         LJL_Http::send404Header();
         $output->setTemplate('404');
         return;
     }
     $pageStr = Libs_Global_Page::getPageString(array('page' => $page, 'pageTotal' => $totalPage, 'urlClass' => 'Blog_Plugin_Urls', 'urlFunc' => 'getListUrl', 'args' => array('page' => $page, 'cate' => $cate, 'tag' => $tag)));
     //获取各分类下tag标签
     if ($cateList) {
         $tagsArr = [];
         foreach ($cateList as $cateKey => $cateV) {
             $tagsArr[$cateKey] = Helper_Blog::getTags(array('cate' => $cateKey, 'limit' => 40));
         }
     }
     //面包屑导航
     $nav[0]['title'] = '首页';
     $nav[0]['url'] = WWW_WEB;
     if (!$cate) {
         $nav[1]['title'] = $tag ? $tag : '全部';
     } else {
         $nav[1]['title'] = $cateList[$cate][0];
         if ($tag) {
             $nav[1]['url'] = Blog_Plugin_Urls::getListUrl(array('cate' => $cate));
             $nav[2]['title'] = $tag;
         }
     }
     $pageTitle = $page > 1 ? '-第' . $page . '页' : '';
     //seo
     $seoTitle = $cate ? $tag ? $cateList[$cate][0] . '分类 - ' . $tag . '标签' : $cateList[$cate][0] . '分类' : $tag . '标签';
     $output->seoArr = array('title' => $seoTitle . $pageTitle . ' - ' . BLOG_SEO_TITTLE . ' | 最红博 ');
     $output->tagsArr = $tagsArr;
     $output->cate = $cate;
     $output->tag = $tag;
     $output->nav = $nav;
     $output->cateList = $cateList;
     $output->pageStr = $pageStr;
     $output->articleList = $articleList;
     $output->header = $output->fetchCol("Part/Main/Header");
     $output->footer = $output->fetchCol("Part/Main/Footer");
     $output->navbarTpl = $output->fetchCol("Part/Navbar");
     $output->leftsideCate = $output->fetchCol("Part/LeftsideCate");
     $output->navGuideTpl = $output->fetchCol("Part/Navguide");
     $output->newArticleTpl = $output->fetchCol("Part/NewArticle");
     $output->searchTpl = $output->fetchCol("Part/Search");
     $output->setTemplate('List');
 }