SimplePie 1.5 is now available!

SimplePie Documentation.  Learn how to use this thing.  It's way better than going to school.

You are here: Documentation » API Reference » SimplePie » merge_items()

merge_items()

Description

class SimplePie {
	merge_items ( array $objects,  [int $start = 0],  [int $length = 0])
}

This method merges the items from multiple SimplePie objects.

:!: If you're merging multiple feeds together, they need to all have dates for the items or else PHP will sort them to the top.

Availability

  • Available since SimplePie 1.0.

Parameters

objects (required)

An array of SimplePie objects.

start

The number of the item you want to start at. Remember that arrays begin with 0, not 1.

length

The number of items to return. 0 will return all. The start parameter is required if this is used.

Examples

Set the feed URL to the SimplePie blog

$digg = new SimplePie('http://digg.com/rss/index.xml');
 
$tuaw = new SimplePie();
$tuaw->set_feed_url('http://feeds.tuaw.com/weblogsinc/tuaw');
$tuaw->set_favicon_handler('handler_image.php');
$tuaw->init();
 
$uneasy = new SimplePie('http://feeds.uneasysilence.com/uneasysilence/blog');
 
$merged = SimplePie::merge_items(array($digg, $tuaw, $uneasy));
 
header('Content-type:text/html; charset=utf-8');
 
$item = $merged[0];
echo $item->get_title(); 

See Also


reference/simplepie/merge_items.txt · Last modified: 2011/03/06 03:56 (external edit)