public function indexAction() { $banners = $this->adModel->getAdByPosition(BaseConst::AD_POSITION_INDEX_BANNER); $indexSecondAd = $this->adModel->getAdByPosition(BaseConst::AD_POSITION_INDEX_SECOND); $indexThirdLeftAd = $this->adModel->getAdByPosition(BaseConst::AD_POSITION_INDEX_THIRD_LEFT); $indexThirdRightAd = $this->adModel->getAdByPosition(BaseConst::AD_POSITION_INDEX_THIRD_RIGHT); $stores = $this->storeModel->getRecommendStores(); $stores = $stores['data']; $products = $this->productModel->getIndexRecommendProducts(); $indexRecommendArticles = $this->articleModel->getIndexRecommendArticles(); foreach ($indexRecommendArticles 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']; } } $indexRecommendArticles[$k]['articleContent'] = Utility::mbCutStr(Utility::getBodyText($v['articleContent']), 80); } $indexArticleList = $this->articleModel->getIndexArticleList(); $friendlyLinks = $this->friendlyLinkModel->select()->toArray(); $this->view->setVariables(array('products' => $products['products'], 'banners' => $banners, 'stores' => $stores, 'indexSecondAd' => $indexSecondAd, 'indexThirdLeftAd' => $indexThirdLeftAd, 'indexThirdRightAd' => $indexThirdRightAd, 'indexRecommendArticles' => $indexRecommendArticles, 'indexArticleList' => $indexArticleList, 'friendlyLinks' => $friendlyLinks)); return $this->view; }
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; }
public function markAction() { $res = $this->memberArticleMarkModel->getArticles(array('MemberArticleMark.memberID' => $this->_zoneInfo['memberID']), $this->pageNum, $this->limit); $articles = $res['data']; foreach ($articles as $k => $v) { $articles[$k]['memberArticleContent'] = Utility::mbCutStr(strip_tags($v['memberArticleContent']), 100); } $this->view->setVariables(array('articles' => $articles, 'pages' => $res['pages'])); return $this->view; }
public function getIndexRecommendArticles() { $select = $this->getSql()->select(); $select->join(array('b' => 'ArticleCategory'), 'Article.articleCategoryID = b.articleCategoryID', array('categoryName')); $select->where(array('isIndexRecommend' => 1, 'b.display' => 1, 'isDel' => 0)); $select->limit(2); $result = $this->selectWith($select)->toArray(); foreach ($result as $k => $v) { $articleContent = Utility::getBodyText($v['articleContent']); $result[$k]['articleContent'] = Utility::mbCutStr($articleContent, 30); } return $result; }