> > 業種・業態で探す
item as $item) { $thisType = "". convert(replaceKana($item->type)); $types = explode("%%%", $thisType); } // XML ファイル読み込み(campaign.xml) $campaign = simplexml_load_file('../cgi-bin/campaign.xml'); // 配列へ格納(campaign.xml) $campaigns = array("id" => array(), "ex" => array(), "type" => array()); foreach ($campaign->item as $item) { $thisId = "". $item->id; $thisEx = "". convert(replaceKana($item->ex)); $thisType = "". $item->type; array_push($campaigns["id"], $thisId); array_push($campaigns["ex"], $thisEx); array_push($campaigns["type"], $thisType); } // XML ファイル読み込み(shop.xml) $shop = simplexml_load_file('../cgi-bin/shop.xml'); // 配列へ格納(shop.xml) $targets = array(); $i = 0; foreach ($shop->item as $item) { if (($item->status == "release") && ($item->mode == "charged")) { $flg = true; if (($category) && ($category != $item->category)) $flg = false; if (($area) && ($area != $item->area)) $flg = false; $thisStations = "". convert(replaceKana($item->stations)); $thisStations_ = explode("%%%", $thisStations); for ($s = 0; $s < count($thisStations_); $s++) { if ($thisStations_[$s] == "上本町") { $thisStations_[$s] = "大阪上本町"; $thisStations = implode($thisStations_, "%%%"); break; } } if (($station) && (strpos($thisStations, $stationName) === FALSE)) $flg = false; if ($flg) { $targets[$i]["id"] = "". $item->id; $targets[$i]["category"] = "". $item->category; $targets[$i]["header"] = "". convert(replaceKana($item->header)); $targets[$i]["image"] = "". $item->image; $targets[$i]["name"] = "". convert(replaceKana($item->name)); $thisInfoItems = array("", ""); for ($x = 1; $x < 6; $x++) { $thisInfoId = "info0". $x; $thisInfoStr = "". convert(replaceKana($item->$thisInfoId)); if ($thisInfoStr) { $thisInfo = explode("%%%", $thisInfoStr); if ($thisInfoItems[1] < $thisInfo[1]) { $thisInfoItems[0] = $thisInfo[0]; $thisInfoItems[1] = $thisInfo[1]; } } } $targets[$i]["info"] = $thisInfoItems[0]; $thisDate = date("Y/m/d"); $coupon01 = false; $thisCoupon = "". convert(replaceKana($item->coupon01)); if ($thisCoupon) { $thisCoupons = explode("%%%", $thisCoupon); if (!$thisCoupons[1]) { $coupon01 = true; } else if ($thisCoupons[1] >= $thisDate) { $coupon01 = true; } } $coupon02 = false; $thisCoupon = "". convert(replaceKana($item->coupon02)); if ($thisCoupon) { $thisCoupons = explode("%%%", $thisCoupon); if ($thisCoupons[1] >= $thisDate) $coupon02 = true; } if (($coupon01) || ($coupon02)) $targets[$i]["coupon"] = true; $targets[$i]["access"] = "". convert(replaceKana($item->access)); $num = array_search($targets[$i]["id"], $campaigns["id"]); if ($num !== FALSE) { $campaignNum = intval(substr($campaigns["type"][$num], 4)); $targets[$i]["campaign"] = $types[$campaignNum]; } $targets[$i]["update"] = "". $item->update; $i++; } } } // 更新日順にソート usort($targets, "cmp"); // nav 表示 echo tab(2). $titleSrc. "検索結果:". count($targets). "件
\n"; $navSrc = ""; // 表示開始件数が 0 ではない if ($page > 1) { $navStr = "page=". ($page - 1). "&category=". $category. "&area=". $area. "&station=". $station; $lt = createNav($navStr); $prevNum = "<前の10件"; $navSrc .= (tab(3). "". $prevNum. "\n"); } // 表示終了件数をアイテム数が上回る if (count($targets) > ($page * 10)) { if ($navSrc) $navSrc .= " | "; $navStr = "page=". ($page + 1). "&category=". $category. "&area=". $area. "&station=". $station; $lt = createNav($navStr); if (count($targets) > (($page + 1) * 10)) { $nextNum = "次の10件>"; } else { $nextNum = "次の". (count($targets) - ($page * 10)). "件>"; } $navSrc .= (tab(3). "". $nextNum. "\n"); $end = $page * 10; } else { $end = count($targets); } $start = ($page - 1) * 10; if ($navSrc) echo tab(2). "\n". $navSrc. tab(2). "\n"; if ($end > 0) echo tab(2). ($start + 1). "〜". $end. "件目"; // 内容の表示 echo tab(2). "
\n"; $navStr = "page=". $page. "&category=". $category. "&area=". $area. "&station=". $station. "&keywords=". $keyword. "&prev=list"; $lt = createNav($navStr); for ($i = $start; $i < $end; $i++) { $thisName = $targets[$i]["name"]; echo tab(3). "[". $thisName. "]
\n"; echo tab(3). "
\n"; echo tab(4). $targets[$i]["header"]. "
\n"; if ($targets[$i]["info"]) echo tab(4). $targets[$i]["info"]. "
\n"; $couponSrc = ""; if ($targets[$i]["coupon"]) $couponSrc .= (tab(4). "[クーポンあり]"); if ($targets[$i]["campaign"]) $couponSrc .= (tab(4). "[". $targets[$i]["campaign"]. "]"); if ($couponSrc) $couponSrc .= "
\n"; echo $couponSrc; echo tab(4). str_replace("
", "、", $targets[$i]["access"]). "
\n"; echo tab(3). "
\n"; echo tab(3). "
\n"; } echo tab(2). "
\n"; if ($navSrc) echo tab(2). "\n". $navSrc. tab(2). "\n"; ?>