ITニュース

管理人が厳選したIT関連ニュースのサマリーです。

'ITmedia総合', 'url'=>'http://www.itmedia.co.jp/', 'max'=>5); // フィードのURL $rsses[] = fetch_rss('http://rss.rssad.jp/rss/itmtop/1.0/topstory.xml'); // 以下繰り返し $names[] = array('name'=>'ZDNet Japan総合', 'url'=>'http://japan.zdnet.com/', 'max'=>5); $rsses[] = fetch_rss('http://feeds.japan.zdnet.com/zdnet/rss'); $names[] = array('name'=>'CNET Japan総合', 'url'=>'http://japan.cnet.com/', 'max'=>8); $rsses[] = fetch_rss('http://feeds.japan.cnet.com/cnet/rss'); $names[] = array('name'=>'Engadget 日本版', 'url'=>'http://japanese.engadget.com/', 'max'=>5); $rsses[] = fetch_rss('http://feeds.feedburner.com/engadget/japanese'); $names[] = array('name'=>'The Blog Herald 翻訳版', 'url'=>'http://jp.blogherald.com/', 'max'=>5, 'timeoffset'=>-9); $rsses[] = fetch_rss('http://jp.blogherald.com/feed/'); //$names[] = array('name'=>'ITpro総合', 'url'=>'', 'max'=>5); //$rsses[] = fetch_rss('http://pheedo.nikkeibp.co.jp/f/ITpro'); // 次の行はデバッグ用に配列の内容を表示させるためのもの //print '
'; print_r($rsses); print '
'; // 表示する情報を配列に整理して格納 $i = 0; $items = array(); foreach ($rsses as $rss) { $sitename = $names[$i]['name']; $siteurl = $names[$i]['url']; if ($names[$i]['max'] == '') { $maxitems = $d_maxitems; } else { $maxitems = $names[$i]['max']; } //print "$sitename, $maxitems; "; $timeoffset = 0; if ($names[$i]['timeoffset'] != NULL) { $timeoffset = $names[$i]['timeoffset']; } $arr = array_slice($rss->items, 0, $maxitems); //$arr = array_slice($rss->items, 0); foreach ($arr as $ar) { // 日付データの取得 if ($ar['dc']['date'] != '') { $date = $ar['dc']['date']; } elseif ($ar[pubdate] != '') { $date = $ar[pubdate]; } elseif ($ar[issued] != '') { $date = $ar[issued]; } else { $date = ''; } // 重複記事のスキップ foreach ($items as $item) { if ($item['title'] == $ar['title']) { continue 2; } } // 配列に整形 $items[] = array('date' => strtotime($date) + $timeoffset*3600, 'sitename' => $sitename, 'siteurl' => $siteurl, 'title' => $ar['title'], 'link' => $ar['link'], 'summary' => $ar['summary'] ); } $i++; } // タイムスタンプで降順に並べ替え rsort($items); ?> アイテムがありません。

'; else // アイテムがあるとき $i = 0; foreach ( $items as $item ) : $i++; if ($i > $total_maxitems) { break; } ?>

' title='' target="_blank">

$maxlen) { $tail = " ..."; } echo mb_substr($summary, 0, $maxlen) . $tail; ?> ' title='' target="_blank"> » 続きを読む