set_feed_url($url); // Tempted to force feed and see if that returns more data from some of the feeds... // Problem in default blogspot feeds isn't going away, just removed them from list of feeds to merge $feed->init(); // How many items per feed should we try to grab? $items_per_feed = 1; // As long as we're not trying to grab more items than the feed has, go through them one by one and add them to the array. for ($x = 0; $x < $feed->get_item_quantity($items_per_feed); $x++) { $first_items[] = $feed->get_item($x); } // We're done with this feed, so let's release some memory. unset($feed); } // We need to sort the items by date with a user-defined sorting function. Since usort() won't accept "SimplePie::sort_items", we need to wrap it in a new function. function sort_items($a, $b) { return SimplePie::sort_items($a, $b); } // Now we can sort $first_items with our custom sorting function. usort($first_items, "sort_items"); // Begin the RSS Feed echo ''; ?> Merged Feeds http://news.muschamp.ca Merged feeds into a single feed, with one item from each feed, sorted by publish date. en-us get_feed(); $feed->xml_dump = true; // Added newline characters to make it easier to debug print('' . "\n"); print('' . $feed->get_title() . ' : ' . preg_replace("/&#?[a-z0-9]{2,8};/i", "", $item->get_title()) . '' . "\n"); print('' . $item->get_permalink() . '' . "\n"); // 16 corresponds to ENT_XML1 // The next line functions fine in my experience but perhaps there is a better way to ensure the feed validates print('' . htmlspecialchars(newsblocks::cleanup($item->get_description(), 400), 16, "UTF-8") . ''. "\n"); print('' . $item->get_date("D, d M Y H:i:s T") . '' . "\n"); print(''. "\n"); } ?>