Esempio 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');
 }
Esempio n. 2
0
 /**
  * 母站首页
  */
 public function doHome(LJL_Request $input, LJL_Response $output)
 {
     //echo Blog_Plugin_Common::ckid('胡国庆');die;
     //echo 111;die;
     //setcookie('userProvinceId', 'aaa', SYSTEM_TIME + 86400, '/');
     // 	    setcookie('userProvinceId2', 'aaa', SYSTEM_TIME + 86400, '/', '.zhbor.com');
     // 	    die();
     LJL_Http::setExpires(3600);
     $nearTime = SYSTEM_TIME - 30 * 24 * 3600;
     //最热10篇
     $hotList = Helper_Blogconfig::getBlogRankList(array('fields' => array('webSite', 'articleId', 'title', 'cate', 'cateVal', 'score', 'publishTime'), 'pageSize' => 15, 'order' => 'order by score desc', 'publishTime' => $nearTime));
     if (count($hotList) < 10) {
         $hotList = Helper_Blogconfig::getBlogRankList(array('fields' => array('webSite', 'articleId', 'title', 'cate', 'cateVal', 'score', 'publishTime'), 'pageSize' => 15, 'order' => 'order by score desc'));
     }
     //最新10篇
     $newList = Helper_Blogconfig::getBlogRankList(array('fields' => array('webSite', 'articleId', 'title', 'cate', 'cateVal', 'score', 'publishTime'), 'pageSize' => 15, 'order' => 'order by publishTime desc', 'publishTime' => $nearTime));
     if (count($newList) < 10) {
         $newList = Helper_Blogconfig::getBlogRankList(array('fields' => array('webSite', 'articleId', 'title', 'cate', 'cateVal', 'score', 'publishTime'), 'pageSize' => 15, 'order' => 'order by publishTime desc'));
     }
     //推荐10篇
     $recommendList = Helper_Blogconfig::getBlogRankList(array('fields' => array('webSite', 'articleId', 'title', 'descript', 'cate', 'cateVal', 'score', 'publishTime'), 'pageSize' => 10, 'order' => 'order by isRecommend desc,score desc,publishTime desc'));
     //博主100个
     $bloggerList = Helper_Blogconfig::getAdminList(array('page' => 1, 'pageSize' => 100, 'fields' => array('webName', 'webSite'), 'status' => 1, 'order' => 'order by score desc'));
     //自定义(关于本博1篇)
     //seo
     $output->seoArr = array('title' => BLOG_SEO_TITTLE . ' | 最红博 ');
     $output->pageType = 'webHome';
     $output->hotList = $hotList;
     $output->newList = $newList;
     $output->recommendList = $recommendList;
     $output->bloggerList = $bloggerList;
     $output->header = $output->fetchCol("Part/Main/Header");
     $output->footer = $output->fetchCol("Part/Main/Footer");
     $output->setTemplate('Home');
 }
Esempio 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');
 }