示例#1
0
 public function indexAction()
 {
     $articleCategoryID = $this->queryData['articleCategoryID'];
     $display = $this->queryData['display'] ? $this->queryData['display'] : 'preview';
     $articleCategories = $this->articleCategoryModel->getCategories();
     $where = array();
     if (!empty($articleCategoryID)) {
         $where['b.articleCategoryID'] = $articleCategoryID;
     }
     $articles = $this->articleModel->getArticles($this->pageNum, $this->limit, $where);
     foreach ($articles['data'] as $k => $v) {
         if (!empty($v['url'])) {
             preg_match_all('/memberArticleID=([\\d]*)/', $v['url'], $matches);
             $memberArticleID = $matches[1][0];
             if (!empty($memberArticleID)) {
                 $info = $this->memberArticleModel->setColumns(array('memberArticleContent'))->select(array('memberArticleID' => $memberArticleID))->current();
                 $v['articleContent'] = $info['memberArticleContent'];
             }
         }
         $articles['data'][$k]['imgs'] = Utility::getImgs($v['articleContent']);
         $body = Utility::getBodyText($v['articleContent']);
         if (mb_strlen($body) > 300) {
             $articles['data'][$k]['fullContent'] = 0;
         } else {
             $articles['data'][$k]['fullContent'] = 1;
         }
         $articles['data'][$k]['articleContent'] = Utility::mbCutStr($body, 300);
     }
     $this->view->setVariables(array('articleCategories' => $articleCategories, 'articles' => $articles['data'], 'pages' => $articles['page'], 'display' => $display, 'articleCategoryID' => $articleCategoryID));
     return $this->view;
 }
示例#2
0
 public function indexAction()
 {
     $where = array('MemberArticle.memberID' => $this->_zoneInfo['memberID']);
     if (!$this->_isMyZone) {
         $where['MemberArticle.isHide'] = 0;
     }
     $res = $this->memberArticleModel->getArticles($where, $this->pageNum, $this->limit);
     $articles = $res['data'];
     foreach ($articles as $k => $v) {
         $articles[$k]['imgs'] = Utility::getImgs($v['memberArticleContent']);
         $body = Utility::getBodyText($v['memberArticleContent']);
         if (mb_strlen($body) > 300) {
             $articles[$k]['fullContent'] = 0;
         } else {
             $articles[$k]['fullContent'] = 1;
         }
         $articles[$k]['memberArticleContent'] = Utility::mbCutStr($body, 300);
     }
     $this->view->setVariables(array('articles' => $articles, 'pages' => $res['pages']));
     return $this->view;
 }