コード例 #1
0
 /**
  * Detail Action
  */
 public function detailAction()
 {
     //set cache
     $this->_request->setParam('cache_file', 1);
     //Get article id
     $id = $this->_request->getParam('id', 0);
     if (!is_numeric($id) || $id <= 0) {
         $this->_redirect($this->view->configView['linkerror'][DEVICE_ENV]);
     }
     //end if
     //Get full detail article
     $arrData = $this->view->objArticle->getArticleFull($id);
     //********************* Check Detail Article *************************//
     if (empty($arrData)) {
         $this->_redirect($this->view->configView['linkerror'][DEVICE_ENV]);
     }
     //end if
     //********************* Check Bài Hẹn Giờ *************************//
     if (intval($arrData['publish_time']) > time()) {
         //secr not match
         if (md5($id . $arrData['creation_time']) != $this->_request->getParam('sig')) {
             //redirect về Trang Error
             $this->_redirect($this->view->configView['linkerror'][DEVICE_ENV]);
         }
         //end if
     }
     //end if
     //Get string link
     $strLink = $this->view->configView['url'] . $this->_request->getPathInfo();
     //check page
     $pageTypeExt = 0;
     $page = 0;
     //Get page
     $intPage = max(1, $this->_request->getParam('page', 1));
     if ($intPage > 1) {
         //get data page extend
         $arrDataExtend = $this->view->objArticle->getDetailPageExtend($id, $intPage);
         if (!empty($arrDataExtend)) {
             //Page type
             $pageTypeExt = $arrDataExtend['page_type'];
             //unset
             unset($arrDataExtend['creation_time']);
             unset($arrDataExtend['publish_time_format']);
             unset($arrDataExtend['publish_time']);
             //merge page extend to data detail
             $arrData = array_merge($arrData, (array) $arrDataExtend);
             //get link remove -p2
             $strLink = preg_replace('#(-p[\\d]+\\.html)#', '.html', $strLink);
             $page = $intPage;
         } else {
             $strLink = '';
         }
         //end if
     }
     //end if
     //Check page_type popup
     if ($pageTypeExt == 2) {
         $this->view->assign('arrData', $arrData);
         echo $this->view->render('/m240/popup.phtml');
         exit;
     }
     //end if
     //replace share_url
     $arrData['share_url'] = $this->view->ShareurlM240($arrData['share_url']);
     //check link to redirect
     if ($strLink != $arrData['share_url']) {
         //($page>1)?$this->_redirect(str_replace('.html', '-p'.$page.'.html', $arrData['share_url']), array('code'=>301)):$this->_redirect($arrData['share_url'], array('code'=>301));
     }
     //end if
     //Set category id for block_cate user in block
     $this->_request->setParam('cateid', $arrData['category_id']);
     //News object
     $modelNews = Thethao_Model_News::getInstance();
     //Category object
     $modelCate = Thethao_Model_Category::getInstance();
     //********************* Process Tin khác *************************//
     //Init array params other news
     $arrOtherNewsParams = array('category_id' => $arrData['category_id'], 'limit' => LIMIT_OTHER_NEWS + 1, 'offset' => 0, 'article_type' => TYPE_ALL);
     //Get news by rule 2: folder và liston lên folder của tin đang xem)
     $arrOtherNews = $modelNews->getListArticleIdsByRule2($arrOtherNewsParams);
     //check data empty
     if (is_array($arrOtherNews) && !empty($arrOtherNews['data'])) {
         $intKeyExists = array_search($id, $arrOtherNews['data']);
         if ($intKeyExists !== FALSE) {
             unset($arrOtherNews['data'][$intKeyExists]);
         } elseif (isset($arrOtherNews['data'][LIMIT_OTHER_NEWS])) {
             unset($arrOtherNews['data'][LIMIT_OTHER_NEWS]);
         }
         //end if
     }
     //end if
     //********************* Process Topic - Tin liên quan *************************//
     /*
      *  - Nếu bài đang xem thuộc duy nhất 1 topic thì lấy 2 tin mới nhất của topic đó
      *  - Nếu bài đang xem thuộc từ 2 topic trở lên thì lấy 2 tin mới nhất của topic có tin mới nhất
      */
     // GET TOPIC NEWS
     $arrTopic = $arrTopicDetail = array();
     // check empty list topic
     if (!empty($arrData['list_topic_id'])) {
         // get topic object
         $modeTopic = new Fpt_Data_News_Topic();
         // init topic params
         $arrTopicParams = array('site_id' => SITE_ID_VNE, 'topic_id' => $arrData['list_topic_id'], 'limit' => LIMIT_TOPIC_DETAIL + 1, 'offset' => 0, 'withscore' => true, 'article_type' => TYPE_ALL);
         // get list article by topic
         $arrTopic = $modeTopic->getTopicNewsByScore($arrTopicParams);
         // check array topic data
         if (!empty($arrTopic)) {
             $score = 0;
             $temp_topic_id = 0;
             //Loop
             foreach ($arrData['list_topic_id'] as $index => $topic_id) {
                 if (isset($arrTopic[$topic_id]['data'][$id])) {
                     unset($arrTopic[$topic_id]['data'][$id]);
                     $arrTopic[$topic_id]['total'] = $arrTopic[$topic_id]['total'] - 1;
                 }
                 //end if
                 if (empty($arrTopic[$topic_id]['data'])) {
                     unset($arrData['list_topic_id'][$index]);
                 }
                 //end if
                 // get first article to compare
                 $firstCore = current($arrTopic[$topic_id]['data']);
                 if ($firstCore > $score) {
                     $temp_topic_id = $topic_id;
                     $score = $firstCore;
                 }
                 //end if
             }
             //end foreach
             if (!empty($arrData['list_topic_id'])) {
                 // get detail of topic id list
                 $arrTopicDetail = $modeTopic->getDetailTopicByArrId(array($temp_topic_id));
                 $arrTopic = array_slice(array_keys($arrTopic[$temp_topic_id]['data']), 0, LIMIT_TOPIC_DETAIL);
                 $arrTopicDetail = $arrTopicDetail[$temp_topic_id];
                 // set to article instance
                 $this->view->objArticle->setIdBasic($arrTopic);
             }
             //end if
         }
         //end if
     }
     //end if
     //Check empty
     if (!empty($arrOtherNews['data'])) {
         //set obj get Article
         $this->view->objArticle->setIdBasic($arrOtherNews['data']);
     }
     //end if
     //replace image size for mobile
     $content = $arrData['content'];
     $content = preg_replace('/src="(.[^>]*)_500x0.(jpg|gif|png|jpeg)"/', 'src="$1_m_460x0.$2"', $content);
     $content = preg_replace('/src="(.[^>]*).(jpg|gif|png|jpeg)"/', 'src="$1_m_460x0.$2"', $content);
     $content = preg_replace('/src="(.[^>]*)_m_460x0_m_460x0.(jpg|gif|png|jpeg)"/', 'src="$1_m_460x0.$2"', $content);
     //remove all iframe and div has class embed-container
     $content = preg_replace('/<iframe.[^>]*>.*<\\/iframe>/siU', '<div class="clear">&nbsp;</div>', $content);
     $content = preg_replace('/<div(.[^>]*)class="embed-container(.*[^\\"])?"(.[^>])*>(.*)<\\/div><\\/div>/siU', '<div class="clear">&nbsp;</div>', $content);
     $content = $this->view->ShareurlM240($content);
     $arrData['content'] = $content;
     //Trim data
     $arrData['title'] = trim($arrData['title']);
     $arrData['title_format'] = trim($arrData['title_format']);
     $arrData['lead'] = trim($this->view->ShareurlM240($arrData['lead']));
     //********************* Process Meta: title + description + keywords Facebook*************************//
     $strMetaTitle = strip_tags(html_entity_decode($arrData['title'], ENT_COMPAT, 'UTF-8')) . ' - VnExpress Giải Trí';
     $strMetaDescript = strip_tags(html_entity_decode($arrData['lead'], ENT_COMPAT, 'UTF-8')) . ' - VnExpress Giải Trí';
     //********************* Assign to views *************************//
     $this->view->assign(array('arrArticleDetail' => $arrData, 'arrOtherNews' => $arrOtherNews, 'arrTopic' => $arrTopic, 'arrTopicDetail' => $arrTopicDetail, 'intCategoryId' => $arrData['category_id'], 'intArticleId' => $arrData['article_id']));
     // Prepend title
     $this->view->headTitle()->prepend($strMetaTitle);
     $this->view->headMeta()->setName('description', $strMetaDescript)->setName('keywords', $strMetaTitle);
 }
コード例 #2
0
 /**
  * @todo - VnE Thethao detail page
  * @author ThuyNT2
  */
 public function indexAction()
 {
     //set cache
     $this->_request->setParam('cache_file', 1);
     //Get article id
     $intArticleId = (int) $this->_request->getParam('id', 0);
     //Get page
     $intPage = max(1, $this->_request->getParam('page', 1));
     $viewApp = $this->_request->getParam('view', '');
     $modelTeam = Thethao_Model_Team::getInstance();
     if ($intArticleId < 1) {
         $this->_redirect('/');
         return;
     }
     //get detail full of article
     $arrArticleDetail = $this->view->objArticle->getArticleFull($intArticleId);
     //init category of article detail
     $intCategoryId = $arrArticleDetail['category_id'];
     $arrCateWorldcup = array(WORLD_CUP, CATE_ID_TINTUC, CATE_ID_BINHLUAN, CATE_ID_BENLE, CATE_ID_LICHSU);
     //check cate in array worldcup
     if (!in_array($intCategoryId, $arrCateWorldcup)) {
         $this->_redirect($arrArticleDetail['share_url'] . ($viewApp == 'app' ? '?view=app' : ''), array('code' => 301));
     }
     //forward to live action if article type is 5
     if ($arrArticleDetail['article_type'] == 5) {
         //check live match is redirect to match
         if (isset($arrArticleDetail['list_object_type']) && !empty($arrArticleDetail['list_object_type'])) {
             if (isset($arrArticleDetail['list_object_type'][OBJECT_TYPE_MATCH_ARTICLE]) && count($arrArticleDetail['list_object_type'][OBJECT_TYPE_MATCH_ARTICLE] == 1)) {
                 //get match detail
                 $matchId = $arrArticleDetail['list_object_type'][OBJECT_TYPE_MATCH_ARTICLE][0];
                 $this->view->objObject->getMatch()->setId($matchId);
                 $matchDetail = $this->view->objObject->getMatch()->getDetailObjectBasic($matchId);
                 if (!empty($matchDetail)) {
                     $link_worldcup = str_replace('http://thethao.vnexpress.net/thong-ke/', 'http://worldcup.vnexpress.net/report/', $matchDetail['share_url']);
                     $this->_redirect($link_worldcup . ($viewApp == 'app' ? '?view=app' : ''), array('code' => 301));
                 }
             }
         }
         return $this->_forward('live');
     }
     if (!empty($arrArticleDetail['list_object_type'])) {
         foreach ($arrArticleDetail['list_object_type'] as $type => $arrObjId) {
             $this->view->objObject->getObjectByType($type)->setId($arrObjId);
         }
     }
     // detail infomation player
     $arrPlayerData = array();
     if (isset($arrArticleDetail['list_object_type'][OBJECT_TYPE_PLAYER]) && !empty($arrArticleDetail['list_object_type'][OBJECT_TYPE_PLAYER])) {
         $countPlayer = count($arrArticleDetail['list_object_type'][OBJECT_TYPE_PLAYER]);
         foreach ($arrArticleDetail['list_object_type'][OBJECT_TYPE_PLAYER] as $player_id) {
             $arrPlayerData[$player_id] = $this->view->objObject->getObjectByType(OBJECT_TYPE_PLAYER)->getDetailObjectBasic($player_id);
         }
         if ($countPlayer == 1) {
             $player_id = array_shift($arrArticleDetail['list_object_type'][OBJECT_TYPE_PLAYER]);
             //init param get news of playser
             $arrParamNews = array('object_id' => $player_id, 'object_type' => OBJECT_TYPE_PLAYER, 'limit' => LIMIT_NEWS_PLAYER, 'offset' => 0);
             $objectNews = $this->view->objArticle->getObjectNews($arrParamNews);
             if (!empty($objectNews['data'])) {
                 $objectNews['data'] = array_diff($objectNews['data'], array($intArticleId));
                 $this->view->objArticle->setIdBasic($objectNews['data']);
                 $arrPlayerData[$player_id]['object_news'] = $objectNews['data'];
             }
         }
         if (!empty($arrPlayerData)) {
             $arrPlayerData = array_slice($arrPlayerData, 0, 4);
         }
     }
     //thong tin doi bong va tran dau gan day
     $arrTeamData = array();
     if (isset($arrArticleDetail['list_object_type'][OBJECT_TYPE_TEAM]) && !empty($arrArticleDetail['list_object_type'][OBJECT_TYPE_TEAM])) {
         foreach ($arrArticleDetail['list_object_type'][OBJECT_TYPE_TEAM] as $teamId) {
             $arrTeamData[$teamId] = $this->view->objObject->getObjectByType(OBJECT_TYPE_TEAM)->getDetailObjectBasic($teamId);
             $arrTeamData[$teamId]['extend'] = $modelTeam->getDetailTeamExtendByIDs(array($teamId));
             $minHappenDateTime = $arrArticleDetail['publish_time'];
             $maxHappenDateTime = 1405382400;
             // ngay 15-7-2014
             //get match id
             $arrMatchId[$teamId] = array();
             $arrMatchIdOld = array();
             $arrMatchIdFuture = $this->view->objObject->getObjectByType(OBJECT_TYPE_TEAM)->getMatchIDsByTeam($teamId, $maxHappenDateTime, $minHappenDateTime, false);
             $countMatch = count($arrMatchIdFuture);
             if ($countMatch < 3) {
                 $arrMatchIdOld = $this->view->objObject->getObjectByType(OBJECT_TYPE_TEAM)->getMatchIDsByTeam($teamId, $minHappenDateTime, 1402632000, false);
                 $arrMatchId[$teamId] = $arrMatchIdFuture + $arrMatchIdOld;
                 if (!empty($arrMatchId[$teamId])) {
                     asort($arrMatchId[$teamId]);
                 }
             } else {
                 $arrMatchId[$teamId] = $arrMatchIdFuture;
             }
             if (count($arrMatchId[$teamId]) > 3) {
                 $arrMatchId[$teamId] = array_slice($arrMatchId[$teamId], 0, 3, true);
             }
             $arrMatchId[$teamId] = array_keys($arrMatchId[$teamId]);
             unset($arrMatchIdFuture, $arrMatchIdOld);
             if (!empty($arrMatchId[$teamId])) {
                 $arrMatchId[$teamId] = array_unique($arrMatchId[$teamId]);
                 $this->view->objObject->getObjectByType(OBJECT_TYPE_MATCH)->setId($arrMatchId[$teamId]);
                 //get match detail
                 foreach ($arrMatchId[$teamId] as $matchId) {
                     $arrTeamData[$teamId]['match_detail'][$matchId] = $this->view->objObject->getObjectByType(OBJECT_TYPE_MATCH)->getDetailObjectBasic($matchId);
                 }
             }
         }
         if (!empty($arrTeamData)) {
             $arrTeamData = array_slice($arrTeamData, 0, 4);
         }
     }
     //end
     //Du doan doi vo dich & vua pha luoi
     // Get models instance
     $modelFootball = Thethao_Model_Football::getInstance();
     // Get detail table ranking by league and season
     $arrAllMatch = $modelFootball->getListTableRanking(SEASON_ID, LEAGUE_ID);
     if (!empty($arrAllMatch)) {
         //set id object
         $this->view->objObject->getTeam()->setId(array_keys($arrAllMatch));
     }
     //end
     //check public time and now time
     if (intval($arrArticleDetail['publish_time']) > time()) {
         $sig = md5($id . $arrArticleDetail['creation_time']);
         //gen sig
         if ($sig != $this->_request->getParam('sig')) {
             $this->_redirect($this->view->configView['linkerror'][DEVICE_ENV], array('code' => 301));
         }
     }
     //Valid data
     if (empty($arrArticleDetail)) {
         $this->_redirect("/");
     }
     //str link
     $strLink = $this->_request->getPathInfo();
     //get category on breakcumb (Using when view page > 2)
     $page = 1;
     //check page of detail
     if ($intPage > 1) {
         //get data page extend
         $arrDataExtend = $this->view->objArticle->getDetailPageExtend($intArticleId, $intPage);
         if (!empty($arrDataExtend)) {
             unset($arrDataExtend['creation_time'], $arrDataExtend['publish_time_format'], $arrDataExtend['publish_time']);
             //merge page extend to data detail
             $arrArticleDetail = array_merge($arrArticleDetail, (array) $arrDataExtend);
             //Check page_type popup
             if (2 == $arrDataExtend['page_type']) {
                 //Disable layout
                 $this->_helper->layout->disableLayout(true);
                 //Set no render view
                 $this->_helper->viewRenderer->setNoRender(true);
                 $this->view->assign(array('arrData' => $arrArticleDetail));
                 echo $this->view->render('detail/popup.phtml');
                 exit;
             }
             //end if
             //get link remove -p2
             $strLink = preg_replace('#(-p[\\d]+\\.html)#', '.html', $strLink);
             $page = $intPage;
         } else {
             $strLink = '';
         }
     }
     //check redirect link
     if (strpos($arrArticleDetail['share_url'], $strLink) === FALSE && APPLICATION_ENV != 'development') {
         $link_more = $this->view->ShareurlWorldcup($arrArticleDetail['share_url']);
         if ($page > 1) {
             $link_more = str_replace('.html', '-p' . $page . '.html' . ($viewApp == 'app' ? '?view=app' : ''), $arrArticleDetail['share_url']);
         }
         $this->_redirect($link_more, array('code' => 301));
     }
     //check view app
     if (!empty($viewApp) && $viewApp == 'app') {
         //Disable layout
         $this->_helper->layout->disableLayout(true);
         $content = $arrArticleDetail['content'];
         $content = preg_replace('/src="(.[^>]*)_500x0.(jpg|gif|png|jpeg)"/', 'src="$1_m_460x0.$2"', $content);
         $content = preg_replace('/src="(.[^>]*).(jpg|gif|png|jpeg)"/', 'src="$1_m_460x0.$2"', $content);
         $content = preg_replace('/src="(.[^>]*)_m_460x0_m_460x0.(jpg|gif|png|jpeg)"/', 'src="$1_m_460x0.$2"', $content);
         $arrArticleDetail['content'] = $content;
         //Trim data
         $arrArticleDetail['title'] = trim($arrArticleDetail['title']);
         $arrArticleDetail['title_format'] = trim($arrArticleDetail['title_format']);
         $arrArticleDetail['lead'] = trim($arrArticleDetail['lead']);
         // Assign to view
         $this->view->assign(array('flagExc' => $flag, 'isArticleHotVnE' => $arrArticleDetail['privacy'] & 512, 'parentCategoryID' => $arrCateInfo['parent_id'], 'arrArticleDetail' => $arrArticleDetail, 'intCategoryId' => $intCategoryId, 'intArticleId' => $intArticleId, 'arrTeamData' => $arrTeamData, 'arrMatchId' => $arrMatchId, 'arrPlayerData' => $arrPlayerData, 'arrAllMatch' => $arrAllMatch, 'intOtherCate' => $intOtherCate, 'arrNewsArticle' => $arrNewsArticle, 'arrOrtherArticle' => $arrOrtherArticle, 'flagExc' => $flag, 'totalPageOtherNews' => $totalPage, 'totalOtherNews' => $arrNewsArticle['total'], 'intPage' => 1, 'intCateIdPolyAds' => $arrArticleDetail['category_id'], 'articleTrackingId' => $arrArticleDetail['article_id'], 'arrTopic' => $arrTopic, 'arrTopicDetail' => $arrTopicDetail[$temp_topic_id], 'isDetail' => 1, 'ogType' => 'website', 'ogTitle' => $arrArticleDetail['title_format'] . ' - VnExpress World Cup', 'ogUrl' => $share_url, 'ogImage' => !empty($arrArticleDetail['thumbnail_url']) ? $this->view->ImageurlArticle($arrArticleDetail, 'size2') : 'http://m.f9.img.vnexpress.net/2014/01/10/fa68f81afe10b727852361b1894ccc74.jpg', 'ogDescription' => trim(strip_tags(html_entity_decode($arrArticleDetail['lead'], ENT_COMPAT, 'UTF-8')))));
         // SEO
         $arrKeyword = 'World cup 2014, tin tuc , bong da';
         $arrArticleDetail['title'] = html_entity_decode($arrArticleDetail['title'], ENT_QUOTES, 'UTF-8');
         $this->view->headTitle($arrArticleDetail['title'] . ' - VnExpress');
         $this->view->headMeta()->setName('description', trim(strip_tags(html_entity_decode($arrArticleDetail['lead'], ENT_COMPAT, 'UTF-8'))))->setName('keywords', $arrKeyword);
         echo $this->view->render('detail/app.phtml');
         exit;
     }
     //get topic of article detail
     //init topic default
     $arrTopic = array();
     $arrTopicDetail = array();
     if (!empty($arrArticleDetail['list_topic_id'])) {
         //init model topic
         $modelTopic = new Fpt_Data_News_Topic();
         // init topic params
         $arrTopicParams = array('site_id' => 1000000, 'topic_id' => $arrArticleDetail['list_topic_id'], 'limit' => LIMIT_TOPIC_DETAIL + 1, 'offset' => 0, 'withscore' => true, 'article_type' => NULL);
         // get list article by topic
         $arrTopic = $modelTopic->getTopicNewsByScore($arrTopicParams);
         // check array topic data
         if (!empty($arrTopic)) {
             $score = 0;
             $temp_topic_id = 0;
             foreach ($arrArticleDetail['list_topic_id'] as $index => $topic_id) {
                 if (isset($arrTopic[$topic_id]['data'][$intArticleId])) {
                     unset($arrTopic[$topic_id]['data'][$intArticleId]);
                 }
                 if (empty($arrTopic[$topic_id]['data'])) {
                     unset($arrArticleDetail['list_topic_id'][$index]);
                     continue;
                 }
                 // get first article to compare
                 $firstCore = current($arrTopic[$topic_id]['data']);
                 if ($firstCore > $score) {
                     $temp_topic_id = $topic_id;
                     $score = $firstCore;
                 }
             }
             // get detail of topic id list
             $arrTopicDetail = $modelTopic->getDetailTopicByArrId(array($temp_topic_id));
             $arrTopic = array_slice(array_keys($arrTopic[$temp_topic_id]['data']), 0, LIMIT_TOPIC_DETAIL);
             //set id
             $this->view->objArticle->setIdBasic($arrTopic);
         }
     }
     //end get topic of article detail
     //get other news of article detail
     //array default other news
     $arrOrtherArticle = array();
     //get cate instance
     $modelCategory = Thethao_Model_Category::getInstance();
     // Get parent info
     $arrCateInfo = $modelCategory->getDetailbyCateId($intCategoryId);
     $intOtherCate = $intCategoryId;
     //check cate result
     if (!empty($arrCateInfo) && !empty($arrCateInfo['parent_id'])) {
         //check parent_id
         if (SITE_ID != $arrCateInfo['parent_id']) {
             $intOtherCate = $arrCateInfo['parent_id'];
         }
     }
     // Get article detail
     $instanceNews = Thethao_Model_News::getInstance();
     //get list top 15 article with rule 2
     $arrNewsArticle = $instanceNews->getListArticleIdsByRule2(array('category_id' => $intOtherCate, 'limit' => LIMIT_OTHER_NEWS + 1, 'offset' => 0, 'article_type' => NULL));
     if (count($arrNewsArticle['data']) > LIMIT_OTHER_NEWS) {
         $arrDiff = array_diff($arrNewsArticle['data'], array($intArticleId));
         $arrNewsArticle['data'] = array_slice($arrDiff, 0, LIMIT_OTHER_NEWS);
     }
     //set flag check exclude
     $flag = false;
     //check is empty list news
     if (is_array($arrNewsArticle) && !empty($arrNewsArticle['data'])) {
         if (in_array($intArticleId, $arrNewsArticle['data'])) {
             $flag = true;
             //excluse current article
             $arrOrtherArticle = array_diff($arrNewsArticle['data'], array($intArticleId));
         } else {
             $arrOrtherArticle = $arrNewsArticle['data'];
         }
         //then slice to get only 14 item
         $arrOrtherArticle = array_slice($arrOrtherArticle, 0, LIMIT_OTHER_NEWS);
     }
     //end check is empty latest news
     $totalPage = intval(ceil(($arrNewsArticle['total'] - 1) / LIMIT_OTHER_NEWS));
     //end get other news of article detail
     $arrArticleIds = array_unique(array_merge($arrOrtherArticle));
     $this->view->objArticle->setIdBasic($arrArticleIds);
     //Set category id for block_cate user in block & menu breakumb
     $this->_request->setParam('block_cate', $intCategoryId);
     //init cate for set menu
     $idCateMenu = $arrCateInfo['parent_id'] == SITE_ID ? $intCategoryId : $arrCateInfo['parent_id'];
     //set cate active
     $this->_request->setParam('cateActiveId', $intCategoryId);
     //set cateid to show active in menu
     $this->_request->setParam('cateid', $idCateMenu);
     //get Instance Block
     $objBlock = Thethao_Plugin_Block::getInstance();
     //set exclude for detail
     $objBlock->setExclude(array($intArticleId));
     //replace image size for mobile
     if (DEVICE_ENV == 1) {
         $content = $arrArticleDetail['content'];
         $content = preg_replace('/src="(.[^>]*)_500x0.(jpg|gif|png|jpeg)"/', 'src="$1_m_460x0.$2"', $content);
         $content = preg_replace('/src="(.[^>]*).(jpg|gif|png|jpeg)"/', 'src="$1_m_460x0.$2"', $content);
         $content = preg_replace('/src="(.[^>]*)_m_460x0_m_460x0.(jpg|gif|png|jpeg)"/', 'src="$1_m_460x0.$2"', $content);
         $arrArticleDetail['content'] = $content;
     }
     //Trim data
     $arrArticleDetail['title'] = trim($arrArticleDetail['title']);
     $arrArticleDetail['title_format'] = trim($arrArticleDetail['title_format']);
     $arrArticleDetail['lead'] = trim($arrArticleDetail['lead']);
     $share_url = str_replace('http://thethao.vnexpress.net', 'http://worldcup.vnexpress.net', $arrArticleDetail['share_url']);
     // Assign to view
     $this->view->assign(array('flagExc' => $flag, 'isArticleHotVnE' => $arrArticleDetail['privacy'] & 512, 'parentCategoryID' => $arrCateInfo['parent_id'], 'arrArticleDetail' => $arrArticleDetail, 'intCategoryId' => $intCategoryId, 'intArticleId' => $intArticleId, 'arrTeamData' => $arrTeamData, 'arrMatchId' => $arrMatchId, 'arrPlayerData' => $arrPlayerData, 'arrAllMatch' => $arrAllMatch, 'intOtherCate' => $intOtherCate, 'arrNewsArticle' => $arrNewsArticle, 'arrOrtherArticle' => $arrOrtherArticle, 'flagExc' => $flag, 'totalPageOtherNews' => $totalPage, 'totalOtherNews' => $arrNewsArticle['total'], 'intPage' => 1, 'intCateIdPolyAds' => $arrArticleDetail['category_id'], 'articleTrackingId' => $arrArticleDetail['article_id'], 'arrTopic' => $arrTopic, 'arrTopicDetail' => $arrTopicDetail[$temp_topic_id], 'isDetail' => 1, 'ogType' => 'website', 'ogTitle' => $arrArticleDetail['title_format'] . ' - VnExpress World Cup', 'ogUrl' => $share_url, 'ogImage' => !empty($arrArticleDetail['thumbnail_url']) ? $this->view->ImageurlArticle($arrArticleDetail, 'size2') : 'http://m.f9.img.vnexpress.net/2014/01/10/fa68f81afe10b727852361b1894ccc74.jpg', 'ogDescription' => trim(strip_tags(html_entity_decode($arrArticleDetail['lead'], ENT_COMPAT, 'UTF-8')))));
     // SEO
     $arrKeyword = 'World cup 2014, tin tuc , bong da';
     $arrArticleDetail['title'] = html_entity_decode($arrArticleDetail['title'], ENT_QUOTES, 'UTF-8');
     $this->view->headTitle($arrArticleDetail['title'] . ' - VnExpress');
     $this->view->headMeta()->setName('description', trim(strip_tags(html_entity_decode($arrArticleDetail['lead'], ENT_COMPAT, 'UTF-8'))))->setName('keywords', $arrKeyword);
 }
コード例 #3
0
 /**
  * @todo - VnE Thethao detail page
  * @author ThuyNT2
  */
 public function indexAction()
 {
     //set cache
     $this->_request->setParam('cache_file', 1);
     //Get article id
     $intArticleId = (int) $this->_request->getParam('id', 0);
     //Get page
     $intPage = max(1, $this->_request->getParam('page', 1));
     $viewApp = $this->_request->getParam('view', '');
     if ($intArticleId < 1) {
         $this->_redirect('/');
         return;
     }
     //get detail full of article
     $arrArticleDetail = $this->view->objArticle->getArticleFull($intArticleId);
     //init category of article detail
     $intCategoryId = $arrArticleDetail['category_id'];
     $arrCateOther = array(SEA_GAMES, CATE_SEA_GAMES_BONGDA, CATE_SEA_GAMES_ANH, CATE_SEA_GAMES_VIDEO, CATE_SEA_GAMES_CACMONKHAC, CATE_SEA_GAMES_BINHLUAN, CATE_SEA_GAMES_BENLE, CATE_SEA_GAMES_THONGTIN);
     //check cate in array other
     if (!in_array($intCategoryId, $arrCateOther)) {
         $this->_redirect($arrArticleDetail['share_url'] . ($viewApp == 'app' ? '?view=app' : ''), array('code' => 301));
     }
     //str link
     $strLink = $this->view->configView['url'] . $this->_request->getPathInfo();
     //forward to live action if article type is 5
     if ($arrArticleDetail['article_type'] == 5) {
         //check page tuong thuat and redirect to tuong thuat or tong thuat
         if ($arrArticleDetail['category_id'] == SEA_GAMES) {
             //check living or not
             if (($arrArticleDetail['privacy'] & 8) == 8) {
                 $strLink = preg_replace('#/tin-tuc/sea-games/#', '/tuong-thuat/', $strLink);
             } else {
                 //get data page extend
                 $arrDataExtend = $this->view->objArticle->getDetailPageExtend($intArticleId, 2);
                 if (!empty($arrDataExtend) && !empty($arrDataExtend['content'])) {
                     unset($arrDataExtend['creation_time'], $arrDataExtend['publish_time_format'], $arrDataExtend['publish_time']);
                     //merge page extend to data detail
                     $arrArticleDetail = array_merge($arrArticleDetail, (array) $arrDataExtend);
                     //get link remove -p2
                     $strLink = preg_replace('#/tin-tuc/sea-games/#', '/tong-thuat/', $strLink);
                 } else {
                     $strLink = preg_replace('#/tin-tuc/sea-games/#', '/tuong-thuat/', $strLink);
                 }
             }
             if (strpos($strLink, '/tuong-thuat/') !== false || strpos($strLink, '/tong-thuat/') !== false) {
                 $strLink = $strLink . ($viewApp == 'app' ? '?view=app' : '');
                 $this->_redirect($strLink, array('code' => 301));
             }
         }
         return $this->_forward('live');
     }
     //get category on breakcumb (Using when view page > 2)
     $page = 1;
     //check page of detail
     if ($intPage > 1) {
         //get data page extend
         $arrDataExtend = $this->view->objArticle->getDetailPageExtend($intArticleId, $intPage);
         if (!empty($arrDataExtend)) {
             unset($arrDataExtend['creation_time'], $arrDataExtend['publish_time_format'], $arrDataExtend['publish_time']);
             //merge page extend to data detail
             $arrArticleDetail = array_merge($arrArticleDetail, (array) $arrDataExtend);
             //Check page_type popup
             if (2 == $arrDataExtend['page_type']) {
                 //Disable layout
                 $this->_helper->layout->disableLayout(true);
                 //Set no render view
                 $this->_helper->viewRenderer->setNoRender(true);
                 $this->view->assign(array('arrData' => $arrArticleDetail));
                 echo $this->view->render('detail/popup.phtml');
                 exit;
             }
             //end if
             //get link remove -p2
             $strLink = preg_replace('#(-p[\\d]+\\.html)#', '.html', $strLink);
             $page = $intPage;
         } else {
             $strLink = '';
         }
     }
     //check redirect link
     if ($strLink != $arrArticleDetail['share_url'] && APPLICATION_ENV != 'development') {
         $link_more = $this->view->ShareurlSeagame($arrArticleDetail['share_url']);
         if ($page > 1) {
             $link_more = str_replace('.html', '-p' . $page . '.html' . ($viewApp == 'app' ? '?view=app' : ''), $arrArticleDetail['share_url']);
         }
         //$this->_redirect($link_more, array('code' => 301));
     }
     //check view app
     if (!empty($viewApp) && $viewApp == 'app') {
         //Disable layout
         $this->_helper->layout->disableLayout(true);
         $content = $arrArticleDetail['content'];
         $content = preg_replace('/src="(.[^>]*)_500x0.(jpg|gif|png|jpeg)"/', 'src="$1_m_460x0.$2"', $content);
         $content = preg_replace('/src="(.[^>]*).(jpg|gif|png|jpeg)"/', 'src="$1_m_460x0.$2"', $content);
         $content = preg_replace('/src="(.[^>]*)_m_460x0_m_460x0.(jpg|gif|png|jpeg)"/', 'src="$1_m_460x0.$2"', $content);
         $arrArticleDetail['content'] = $content;
         //Trim data
         $arrArticleDetail['title'] = trim($arrArticleDetail['title']);
         $arrArticleDetail['title_format'] = trim($arrArticleDetail['title_format']);
         $arrArticleDetail['lead'] = trim($arrArticleDetail['lead']);
         // Assign to view
         $this->view->assign(array('isArticleHotVnE' => $arrArticleDetail['privacy'] & 512, 'arrArticleDetail' => $arrArticleDetail, 'intCategoryId' => $intCategoryId, 'intArticleId' => $intArticleId, 'intPage' => 1, 'isDetail' => 1, 'ogType' => 'website', 'ogTitle' => $arrArticleDetail['title_format'] . ' - VnExpress SEA Games', 'ogImage' => !empty($arrArticleDetail['thumbnail_url']) ? $this->view->ImageurlArticle($arrArticleDetail, 'size2') : 'http://m.f9.img.vnexpress.net/2014/01/10/fa68f81afe10b727852361b1894ccc74.jpg', 'ogDescription' => trim(strip_tags(html_entity_decode($arrArticleDetail['lead'], ENT_COMPAT, 'UTF-8')))));
         // SEO
         $arrKeyword = 'SEA Game 28, tin tuc , bong da';
         $arrArticleDetail['title'] = html_entity_decode($arrArticleDetail['title'], ENT_QUOTES, 'UTF-8');
         $this->view->headTitle($arrArticleDetail['title'] . ' - VnExpress SEA Games');
         $this->view->headMeta()->setName('description', trim(strip_tags(html_entity_decode($arrArticleDetail['lead'], ENT_COMPAT, 'UTF-8'))))->setName('keywords', $arrKeyword);
         echo $this->view->render('detail/app.phtml');
         exit;
     }
     //get topic of article detail
     //init topic default
     $arrTopic = array();
     $arrTopicDetail = array();
     if (!empty($arrArticleDetail['list_topic_id'])) {
         //init model topic
         $modelTopic = new Fpt_Data_News_Topic();
         // init topic params
         $arrTopicParams = array('site_id' => 1000000, 'topic_id' => $arrArticleDetail['list_topic_id'], 'limit' => LIMIT_TOPIC_DETAIL + 1, 'offset' => 0, 'withscore' => true, 'article_type' => NULL);
         // get list article by topic
         $arrTopic = $modelTopic->getTopicNewsByScore($arrTopicParams);
         // check array topic data
         if (!empty($arrTopic)) {
             $score = 0;
             $temp_topic_id = 0;
             foreach ($arrArticleDetail['list_topic_id'] as $index => $topic_id) {
                 if (isset($arrTopic[$topic_id]['data'][$intArticleId])) {
                     unset($arrTopic[$topic_id]['data'][$intArticleId]);
                 }
                 if (empty($arrTopic[$topic_id]['data'])) {
                     unset($arrArticleDetail['list_topic_id'][$index]);
                     continue;
                 }
                 // get first article to compare
                 $firstCore = current($arrTopic[$topic_id]['data']);
                 if ($firstCore > $score) {
                     $temp_topic_id = $topic_id;
                     $score = $firstCore;
                 }
             }
             // get detail of topic id list
             $arrTopicDetail = $modelTopic->getDetailTopicByArrId(array($temp_topic_id));
             $arrTopic = array_slice(array_keys($arrTopic[$temp_topic_id]['data']), 0, LIMIT_TOPIC_DETAIL);
             //set id
             $this->view->objArticle->setIdBasic($arrTopic);
         }
     }
     //end get topic of article detail
     //get cate instance
     $modelCategory = Thethao_Model_Category::getInstance();
     // Get parent info
     $arrCateInfo = $modelCategory->getDetailbyCateId($intCategoryId);
     $intOtherCate = $intCategoryId;
     //check cate result
     if (!empty($arrCateInfo) && !empty($arrCateInfo['parent_id'])) {
         //check parent_id
         if (SITE_ID != $arrCateInfo['parent_id']) {
             $intOtherCate = $arrCateInfo['parent_id'];
         }
     }
     //get other news of article detail from commendation
     $arrOrtherArticle = array();
     $instanceNews = Thethao_Model_News::getInstance();
     //get list top 15 article with rule 2
     $arrNewsArticle = $instanceNews->getListArticleIdsByRule2(array('category_id' => $intOtherCate, 'limit' => LIMIT_OTHER_NEWS + 1, 'offset' => 0, 'article_type' => NULL));
     if (count($arrNewsArticle['data']) > LIMIT_OTHER_NEWS) {
         $arrDiff = array_diff($arrNewsArticle['data'], array($intArticleId));
         $arrNewsArticle['data'] = array_slice($arrDiff, 0, LIMIT_OTHER_NEWS);
     }
     //set flag check exclude
     $flag = false;
     //check is empty list news
     if (is_array($arrNewsArticle) && !empty($arrNewsArticle['data'])) {
         if (in_array($intArticleId, $arrNewsArticle['data'])) {
             $flag = true;
             //excluse current article
             $arrOrtherArticle = array_diff($arrNewsArticle['data'], array($intArticleId));
         } else {
             $arrOrtherArticle = $arrNewsArticle['data'];
         }
         //then slice to get only 14 item
         $arrOrtherArticle = array_slice($arrOrtherArticle, 0, LIMIT_OTHER_NEWS);
     }
     //end check is empty latest news
     //set article id to get detail
     $this->view->objArticle->setIdBasic($arrOrtherArticle);
     //end get other news of article detail
     //get top view article
     $arrTopViewID = array();
     if (DEVICE_ENV != 1) {
         //get top view with rule 4
         $arrTopViewData = $instanceNews->getListArticleIdsByRule4(array('category_id' => $intOtherCate, 'offset' => 0, 'limit' => LIMIT_TOP_VIEW + 1));
         if (!empty($arrTopViewData)) {
             //excluse current article
             $arrTopViewID = array_diff($arrTopViewData, array($intArticleId));
             $arrTopViewID = array_slice($arrTopViewID, 0, LIMIT_TOP_VIEW);
         }
         //set article id to get detail
         $this->view->objArticle->setIdBasic($arrTopViewID);
     }
     //end get top view article
     //Set category id for block_cate user in block & menu breakumb
     $this->_request->setParam('block_cate', $intCategoryId);
     //init cate for set menu
     $idCateMenu = $arrCateInfo['parent_id'] == SITE_ID ? $intCategoryId : $arrCateInfo['parent_id'];
     //set cate active
     $this->_request->setParam('cateActiveId', $intCategoryId);
     //set cateid to show active in menu
     $this->_request->setParam('cateid', SEA_GAMES);
     //get Instance Block
     $objBlock = Thethao_Plugin_Block::getInstance();
     //set exclude for detail
     $objBlock->setExclude(array($intArticleId));
     //replace image size for mobile
     if (DEVICE_ENV == 1) {
         $content = $arrArticleDetail['content'];
         $content = preg_replace('/src="(.[^>]*)_500x0.(jpg|gif|png|jpeg)"/', 'src="$1_m_460x0.$2"', $content);
         $content = preg_replace('/src="(.[^>]*).(jpg|gif|png|jpeg)"/', 'src="$1_m_460x0.$2"', $content);
         $content = preg_replace('/src="(.[^>]*)_m_460x0_m_460x0.(jpg|gif|png|jpeg)"/', 'src="$1_m_460x0.$2"', $content);
         $arrArticleDetail['content'] = $content;
     }
     //Trim data
     $arrArticleDetail['title'] = trim($arrArticleDetail['title']);
     $arrArticleDetail['title_format'] = trim($arrArticleDetail['title_format']);
     $arrArticleDetail['lead'] = trim($arrArticleDetail['lead']);
     //print_r($arrTopic);die;
     // Assign to view
     $this->view->assign(array('flagExc' => $flag, 'isArticleHotVnE' => $arrArticleDetail['privacy'] & 512, 'parentCategoryID' => $arrCateInfo['parent_id'], 'arrArticleDetail' => $arrArticleDetail, 'intCategoryId' => $intCategoryId, 'intArticleId' => $intArticleId, 'intOtherCate' => $intOtherCate, 'arrNewsArticle' => $arrNewsArticle, 'arrOrtherArticle' => $arrOrtherArticle, 'flagExc' => $flag, 'totalOtherNews' => $arrNewsArticle['total'], 'intPage' => 1, 'intCateIdPolyAds' => $arrArticleDetail['category_id'], 'articleTrackingId' => $arrArticleDetail['article_id'], 'arrTopic' => $arrTopic, 'arrTopicDetail' => $arrTopicDetail[$temp_topic_id], 'arrTopViewID' => $arrTopViewID, 'isDetail' => 1, 'ogType' => 'article', 'ogTitle' => $arrArticleDetail['title_format'] . ' - VnExpress SEA Games', 'ogUrl' => $this->view->ShareurlSeagame($arrArticleDetail['share_url']), 'ogImage' => !empty($arrArticleDetail['thumbnail_url']) ? $this->view->ImageurlArticle($arrArticleDetail, 'size2') : 'http://m.f9.img.vnexpress.net/2014/01/10/fa68f81afe10b727852361b1894ccc74.jpg', 'ogDescription' => trim(strip_tags(html_entity_decode($arrArticleDetail['lead'], ENT_COMPAT, 'UTF-8')))));
     // SEO
     $arrKeyword = 'SEA Games 28, tin tuc , bong da';
     $arrArticleDetail['title'] = html_entity_decode($arrArticleDetail['title'], ENT_QUOTES, 'UTF-8');
     $this->view->headTitle($arrArticleDetail['title'] . ' - VnExpress SEA Games');
     $this->view->headMeta()->setName('description', trim(strip_tags(html_entity_decode($arrArticleDetail['lead'], ENT_COMPAT, 'UTF-8'))))->setName('keywords', $arrKeyword);
 }
コード例 #4
0
 /**
  * tong thuat football match
  * @return void
  */
 public function tongThuatAction()
 {
     //set cache
     $this->_request->setParam('cache_file', 1);
     //get article detail to check link then redirect of false
     $intArticleId = (int) $this->_request->getParam('id');
     $viewApp = $this->_request->getParam('view', '');
     //get detail article
     $arrArticleDetail = $this->view->objArticle->getArticleFull($intArticleId);
     //get topic of article detail
     //set topic show style
     $topic_show_style = 1;
     //init topic default
     $arrTopic = array();
     $arrTopicDetail = array();
     if (!empty($arrArticleDetail['list_topic_id'])) {
         //init model topic
         $modelTopic = new Fpt_Data_News_Topic();
         // init topic params
         $arrTopicParams = array('site_id' => 1000000, 'topic_id' => $arrArticleDetail['list_topic_id'], 'limit' => LIMIT_TOPIC_DETAIL + 1, 'offset' => 0, 'withscore' => true, 'article_type' => NULL);
         // get list article by topic
         $arrTopic = $modelTopic->getTopicNewsByScore($arrTopicParams);
         // check array topic data
         if (!empty($arrTopic)) {
             $score = 0;
             $temp_topic_id = 0;
             foreach ($arrArticleDetail['list_topic_id'] as $index => $topic_id) {
                 if (isset($arrTopic[$topic_id]['data'][$intArticleId])) {
                     unset($arrTopic[$topic_id]['data'][$intArticleId]);
                 }
                 if (empty($arrTopic[$topic_id]['data'])) {
                     unset($arrArticleDetail['list_topic_id'][$index]);
                     continue;
                 }
                 // get first article to compare
                 $firstCore = current($arrTopic[$topic_id]['data']);
                 if ($firstCore > $score) {
                     $temp_topic_id = $topic_id;
                     $score = $firstCore;
                 }
             }
             // get detail of topic id list
             $arrTopicDetail = $modelTopic->getDetailTopicByArrId(array($temp_topic_id));
             //shift data
             $arrShift = isset($arrArticleDetail['list_topic_full'][$temp_topic_id]) ? $arrArticleDetail['list_topic_full'][$temp_topic_id] : array_shift($arrArticleDetail['list_topic_full']);
             //set topic style topic
             $topic_show_style = $arrShift['show_style'] != 2 ? 1 : $arrShift['show_style'];
             //array slice list article
             $arrTopic = array_slice(array_keys($arrTopic[$temp_topic_id]['data']), 0, $topic_show_style == 1 ? LIMIT_TOPIC_DETAIL_STYLE_1 : LIMIT_TOPIC_DETAIL_STYLE_2);
             //set id basic
             $this->view->objArticle->setIdBasic($arrTopic);
         }
     }
     //end get topic of article detail
     //check link info
     $strLink = $this->_request->getParam(2) . '-' . $intArticleId . '.html';
     if (strpos($arrArticleDetail['share_url'], rtrim($strLink, '/')) === FALSE) {
         $strLink = preg_replace('#/tin-tuc/tuong-thuat/#', '/tong-thuat/', $arrArticleDetail['share_url']);
         $strLink = $strLink . (in_array($viewApp, array('app', 'app_sport_live')) ? '?view=' . $viewApp : '');
         $this->_redirect($strLink, array('code' => 301));
     }
     //get all block of the article
     //init model live data
     $objLive = Fpt_Data_News_Live::getInstance();
     //init param to get block
     $arrParamBlock = array('article_id' => $intArticleId, 'order' => 0, 'from_time' => NULL);
     $arrBlockDataId = $objLive->getListBlockByArticleId($arrParamBlock);
     //set block id if not null
     if (!empty($arrBlockDataId['data'])) {
         $objLive->setBlockId($arrBlockDataId['data']);
     }
     //end get all block of the article
     //check and get tong thuat if have
     $isReview = false;
     $arrDataExtend = $this->view->objArticle->getDetailPageExtend($intArticleId, 2);
     if (!empty($arrDataExtend) && !empty($arrDataExtend['content'])) {
         unset($arrDataExtend['creation_time'], $arrDataExtend['publish_time_format'], $arrDataExtend['publish_time']);
         //merge page extend to data detail
         $arrArticleDetail['content_review'] = $arrDataExtend['content'];
         $isReview = true;
     }
     //Set category id for block_cate user in block & menu breakumb
     $this->_request->setParam('block_cate', $arrArticleDetail['category_id']);
     //set cate active
     $this->_request->setParam('cateActiveId', $arrArticleDetail['category_id']);
     //set cateid to show active in menu
     $this->_request->setParam('cateid', $arrArticleDetail['category_id']);
     //get Instance Block
     $objBlock = Thethao_Plugin_Block::getInstance();
     //set exclude for detail
     $objBlock->setExclude(array($intArticleId));
     //replace image size for mobile
     if (DEVICE_ENV == 1) {
         $content = $arrArticleDetail['content_review'];
         $content = preg_replace('/src="(.[^>]*)_500x0.(jpg|gif|png|jpeg)"/', 'src="$1_m_460x0.$2"', $content);
         $content = preg_replace('/src="(.[^>]*).(jpg|gif|png|jpeg)"/', 'src="$1_m_460x0.$2"', $content);
         $content = preg_replace('/src="(.[^>]*)_m_460x0_m_460x0.(jpg|gif|png|jpeg)"/', 'src="$1_m_460x0.$2"', $content);
         $arrArticleDetail['content_review'] = $content;
     }
     //Trim data
     $arrArticleDetail['title'] = trim($arrArticleDetail['title']);
     $arrArticleDetail['title_format'] = trim($arrArticleDetail['title_format']);
     $arrArticleDetail['lead'] = trim($arrArticleDetail['lead']);
     // Assign to view
     $this->view->assign(array('arrArticleDetail' => $arrArticleDetail, 'intCategoryId' => $arrArticleDetail['category_id'], 'intArticleId' => $intArticleId, 'isArticleHotVnE' => $arrArticleDetail['privacy'] & 512, 'timeUpdate' => $arrBlockDataId['time'], 'arrTopic' => $arrTopic, 'arrTopicDetail' => $arrTopicDetail[$temp_topic_id], 'topic_show_style' => $topic_show_style, 'strLinkTuongThuat' => '/tuong-thuat/' . $strLink . (in_array($viewApp, array('app', 'app_sport_live')) ? '?view=' . $viewApp : ''), 'ogType' => 'website', 'ogTitle' => $arrArticleDetail['title_format'] . ' - VnExpress Thể Thao', 'ogUrl' => preg_replace('#/tin-tuc/tuong-thuat/#', '/tong-thuat/', $arrArticleDetail['share_url']), 'ogImage' => !empty($arrArticleDetail['thumbnail_url']) ? $this->view->ImageurlArticle($arrArticleDetail, 'size2') : 'http://m.f9.img.vnexpress.net/2014/01/10/fa68f81afe10b727852361b1894ccc74.jpg', 'ogDescription' => trim(strip_tags(html_entity_decode($arrArticleDetail['lead'], ENT_COMPAT, 'UTF-8')))));
     // SEO
     $arrKeyword = array();
     $arrArticleDetail['title'] = html_entity_decode($arrArticleDetail['title'], ENT_QUOTES, 'UTF-8');
     $this->view->headTitle($arrArticleDetail['title'] . ' - VnExpress Thể Thao');
     $this->view->headMeta()->setName('description', trim(strip_tags(html_entity_decode($arrArticleDetail['lead'], ENT_COMPAT, 'UTF-8'))))->setName('keywords', join(',', $arrKeyword));
     //check view app
     if (!empty($viewApp) && in_array($viewApp, array('app', 'app_sport_live'))) {
         $this->view->assign(array('viewApp' => $viewApp));
         //Disable layout
         $this->_helper->layout->disableLayout(true);
         echo $this->view->render('detail/app-tong-thuat.phtml');
         exit;
     }
 }