array('000', '總覽', 'al')), $magCatNameAry); # 接入變數 $getCatInfo = getCatInfo($_GET['c'], 'magazine'); if (!$getCatInfo) { if (preg_match("/^\/magazine(\/|\/\d+\/?)?/", $_SERVER['REQUEST_URI'])) { $cid = '000'; $cat_cname = '總覽'; $cat_ename = 'al'; } else { oops('000'); } } else { $cid = $getCatInfo['cid']; $cat_cname = $getCatInfo['cat_cname']; $cat_ename = $getCatInfo['cat_ename']; } $cat_subtype = (isset($_GET['subtype']) && $_GET['subtype'] == 'hot') ? 'hot' : 'new'; $list_style = (isset($_COOKIE['website_viewmode']) && $_COOKIE['website_viewmode'] == 'summary') ? 'summary' : ''; # 頁碼處理 $page = (isset($_GET['p']) && (int)$_GET['p'] >= 1) ? $_GET['p'] : 1; $itemPerPage = ($list_style == 'summary') ? 60 : 30; $itemStart = ($page - 1) * $itemPerPage; $headItem = array(); # 讀取雜誌 (頭條) $headItem_ma = array(); if ($page == 1) { $incfile = $MAG_DATA_DIR . 'head_list_auto_' . $cid . '.inc'; $headItem = LoadRequireFile($incfile); $headItem = is_array($headItem) ? array_map('make_headItem', $headItem) : array(); $headItemOne = isset($headItem[0]) ? $headItem[0] : array(); if (isset($headItem[0])) { unset($headItem[0]); } if (!empty($headItem)) { $headItem = array_values($headItem); } $headItem_ma = $headItem; } #雜誌頭條 檢查圖片 foreach ($headItem_ma as $key => $val) { $img = $val['picsrc']; $img = str_replace("_m.jpg", ".jpg", $img); $headItem_ma[$key]['picsrc'] = $img; } # 讀取雜誌 (雜誌) $incfile = $MAG_DATA_DIR . $cat_subtype . '_list_' . $cid . '.inc'; $newsList = LoadRequireFile($MAG_DATA_DIR . $cat_subtype . '_list_' . $cid . '.inc'); $totalNews = is_array($newsList) ? count($newsList) : 0; $tmpItem = is_array($newsList) ? array_slice($newsList, $itemStart, $itemPerPage) : array(); if (count($tmpItem) == 0) { oops('000'); } $newsList = is_array($newsList) ? array_map('make_newsList', $tmpItem) : array(); # 右欄空氣品質 $rightAir = rightAir(); # 右欄氣象資訊 $rightWeather = right_get_weather(); # 右欄樂透 $rightLottery = rightLottery(); # 右欄星座 $rightConstellation = rightConstellation(); # 雜誌快訊 //$magazineItem = rightMagazine(); #右欗媒體名單 $collMagMediaItem = rightCollMedia('magazine'); # 頁面資訊 $html_title = '雜誌 - PChome Online 新聞'; $html_description = $html_keywords = ''; foreach ($newsList as $k => $v) { if (strstr($html_description, $v['title'])) { continue; } $html_description .= $v['title'] . ', '; if (strstr($html_keywords, $v['media_cname'])) { continue; } $html_keywords .= $v['media_cname'] . ', '; } $html_description = substr($html_description, 0, -2); $html_keywords = substr($html_keywords, 0, -2); # 廣告 $UAD = getUserAD(90, 91, 92, 93, 94); # 時間檢測 PageLoadCostTime(); # 記憶體檢測 PageLoadCostMemory(); # PV 記錄 pv('MI', ($cid ? $cid : '000')); $pv_js_code = pv_js_code('MI', ($cid ? $cid : '000')); # 讀入版型 $template = $TEMPLATES . 'base_body.tpl.html'; require_once($template); function make_headItem($v) { return array( 'title' => $v['title'], 'cat_ename' => $v['ecat'], 'cat_cname' => $v['cat'], 'media_ename' => '', 'media_cname' => $v['media'], 'pubdate' => $v['pubdate'], 'desc' => $v['desc'], 'content' => '', 'link' => $v['link'], 'picsrc' => changPhotoSize($v['pic'], 'm'), 'piclink' => '', 'keyword' => $v['keyword'], 'pv' => $v['pv'], ); } function make_newsList($v) { return array( 'title' => $v['title'], 'cat_ename' => $v['ecat'], 'cat_cname' => $v['cat'], 'media_ename' => '', 'media_cname' => $v['media'], 'pubdate' => $v['pubdate'], 'desc' => $v['desc'], 'content' => '', 'link' => $v['link'], 'picsrc' => changPhotoSize($v['pic'], 's'), 'pic' => changPhotoSize($v['pic'], 'p23'), 'piclink' => '', 'keyword' => $v['keyword'], 'pv' => $v['pv'], ); }