Ignore:
Timestamp:
2008/08/26 17:02:14 (16 years ago)
Author:
Seasoft
Message:

モバイルサイトを使わない場合、パラメータ設定によりサイトマップに出力されないように設定可能に。本来はモバイルサイトの出力も抑制したかったが、一旦断念した(コメントに記載)。

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/comu-ver2/data/class/pages/LC_Page_Sitemap.php

    r16582 r17558  
    7878    function init() { 
    7979        parent::init(); 
    80         $this->staticURL = array(SITE_URL, MOBILE_SITE_URL, SITE_URL . "rss/index.php"); 
     80 
     81        $this->staticURL[] = SITE_URL; 
     82        $this->staticURL[] = SITE_URL . 'rss/index.php'; 
     83        if (USE_MOBILE !== false) { 
     84            $this->staticURL[] = MOBILE_SITE_URL; 
     85        } 
    8186    } 
    8287 
     
    128133            $this->createSitemap($product['url'], '', 'daily'); 
    129134        } 
    130         $mobileProducts = $this->getAllProducts(true); 
    131         foreach($mobileProducts as $mobileProduct) { 
    132             $this->createSitemap($mobileProduct['url'], '', 'daily'); 
    133         } 
    134135 
    135136        // 商品詳細ページを処理 
     
    138139            $this->createSitemap($detail['url'], 
    139140                                 $this->date2W3CDatetime($detail['update_date'])); 
    140         } 
    141         $mobileDetails = $this->getAllDetail(true); 
    142         foreach($mobileDetails as $mobileDetail) { 
    143             $this->createSitemap($mobileDetail['url'],  
    144                                  $this->date2W3CDatetime($mobileDetail['update_date'])); 
    145141        } 
    146142 
     
    222218     * すべての商品一覧ページを取得する. 
    223219     * 
    224      * @param boolean $isMobile モバイルページを取得する場合 true 
    225220     * @return array 検索エンジンからアクセス可能な商品一覧ページの情報 
    226221     */ 
    227     function getAllProducts($isMobile = false) { 
     222    function getAllProducts() { 
     223         
     224        // XXX: 商品登録の無いカテゴリーは除外する方が良い気もする 
    228225        $conn = new SC_DBConn(); 
    229226        $sql = "SELECT category_id FROM dtb_category WHERE del_flg = 0"; 
    230227        $result = $conn->getAll($sql); 
    231228 
    232         $mobile = ""; 
    233         if ($isMobile) { 
    234             $mobile = "mobile/"; 
    235         } 
    236  
    237229        $arrRet = array(); 
    238         for ($i = 0; $i < count($result); $i++) { 
     230        foreach ($result as $row) { 
    239231            // :TODO: カテゴリの最終更新日を取得できるようにする 
    240             $page = array("url" => SITE_URL . sprintf("%sproducts/list.php?category_id=%d", $mobile, $result[$i]['category_id'])); 
    241             $arrRet[$i] = $page; 
     232             
     233            $page["url"] = SITE_URL . 'products/list.php?category_id=' . $row['category_id']; 
     234            $arrRet[] = $page; 
     235             
     236            // モバイルサイト 
     237            if (USE_MOBILE !== false) { 
     238                $page["url"] = MOBILE_SITE_URL . 'products/list.php?category_id=' . $row['category_id']; 
     239                $arrRet[] = $page; 
     240            } 
    242241        } 
    243242        return $arrRet; 
     
    247246     * すべての商品詳細ページを取得する. 
    248247     * 
    249      * @param boolean $isMobile モバイルページを取得する場合 true 
    250248     * @return array 検索エンジンからアクセス可能な商品詳細ページの情報 
    251249     */ 
    252     function getAllDetail($isMobile = false) { 
     250    function getAllDetail() { 
    253251        $conn = new SC_DBConn(); 
    254252        $sql = "SELECT product_id, update_date FROM dtb_products WHERE del_flg = 0 AND status = 1"; 
    255253        $result = $conn->getAll($sql); 
    256254 
    257         $mobile = ""; 
    258         if ($isMobile) { 
    259             $mobile = "mobile/"; 
    260         } 
    261  
    262255        $arrRet = array(); 
    263         for ($i = 0; $i < count($result); $i++) { 
    264             $page = array("url" => SITE_URL. sprintf("%sproducts/detail.php?product_id=%d", $mobile, $result[$i]['product_id']), 
    265                           "update_date" => $result[$i]['update_date']); 
    266             $arrRet[$i] = $page; 
     256        foreach ($result as $row) { 
     257             
     258            $page["update_date"] = $row['update_date']; 
     259             
     260            $page["url"] = SITE_URL . 'products/detail.php?product_id=' . $row['product_id']; 
     261            $arrRet[] = $page; 
     262             
     263            // モバイルサイト 
     264            if (USE_MOBILE !== false) { 
     265                $page["url"] = MOBILE_SITE_URL . 'products/detail.php?product_id=' . $row['product_id']; 
     266                $arrRet[] = $page; 
     267            } 
    267268        } 
    268269        return $arrRet; 
     
    278279     */ 
    279280    function getPageData($where = '', $arrVal = ''){ 
    280         $objDBConn = new SC_DbConn;     // DB操作オブジェクト 
    281         $sql = "";                      // データ取得SQL生成用 
    282         $arrRet = array();              // データ取得用 
     281        $objDBConn = new SC_DbConn;     // DB操作オブジェクト 
     282        $sql = "";                      // データ取得SQL生成用 
     283        $arrRet = array();              // データ取得用 
    283284 
    284285        // SQL生成(url と update_date 以外は不要?) 
    285286        $sql .= " SELECT"; 
    286         $sql .= " page_id";             // ページID 
    287         $sql .= " ,page_name";          // 名称 
    288         $sql .= " ,url";                // URL 
    289         $sql .= " ,php_dir";            // php保存先ディレクトリ 
    290         $sql .= " ,tpl_dir";            // tpl保存先ディdレクトリ 
    291         $sql .= " ,filename";           // ファイル名称 
    292         $sql .= " ,header_chk ";        // ヘッダー使用FLG 
    293         $sql .= " ,footer_chk ";        // フッター使用FLG 
    294         $sql .= " ,author";             // authorタグ 
    295         $sql .= " ,description";        // descriptionタグ 
    296         $sql .= " ,keyword";            // keywordタグ 
    297         $sql .= " ,update_url";         // 更新URL 
    298         $sql .= " ,create_date";        // データ作成日 
    299         $sql .= " ,update_date";        // データ更新日 
     287        $sql .= " page_id";             // ページID 
     288        $sql .= " ,page_name";          // 名称 
     289        $sql .= " ,url";                // URL 
     290        $sql .= " ,php_dir";            // php保存先ディレクトリ 
     291        $sql .= " ,tpl_dir";            // tpl保存先ディdレクトリ 
     292        $sql .= " ,filename";           // ファイル名称 
     293        $sql .= " ,header_chk ";        // ヘッダー使用FLG 
     294        $sql .= " ,footer_chk ";        // フッター使用FLG 
     295        $sql .= " ,author";             // authorタグ 
     296        $sql .= " ,description";        // descriptionタグ 
     297        $sql .= " ,keyword";            // keywordタグ 
     298        $sql .= " ,update_url";         // 更新URL 
     299        $sql .= " ,create_date";        // データ作成日 
     300        $sql .= " ,update_date";        // データ更新日 
    300301        $sql .= " FROM "; 
    301302        $sql .= "     dtb_pagelayout"; 
     
    306307        } 
    307308 
    308         $sql .= " ORDER BY  page_id"; 
     309        $sql .= " ORDER BY page_id"; 
    309310 
    310311        return $objDBConn->getAll($sql, $arrVal); 
Note: See TracChangeset for help on using the changeset viewer.