<div class="span-9">
<div class="social_stream">
<?php
# make your urls and build up some content
$feeds = array("$fb_url", "$tw_url");
$first_items = array();
foreach ($feeds as $url) {
// Use the long syntax
$feed = new SimplePie();
$feed->set_feed_url($url);
$feed->init();
// How many items per feed should we try to grab?
$items_per_feed = 3;
// 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.
usort($first_items, "sort_items");
?>
<?php foreach($first_items as $item): $feed = $item->get_feed(); ?>
<div class="chunk">
<?php $source = $feed->get_permalink();
$favicon = $feed->get_favicon();
?>
<p class="social_content">
<a href="<?php echo $source; ?>"><img src="<?php echo $favicon; ?>" class="" alt="sicon" /></a>
<?php echo $item->get_content(); ?>
</p>
<?php if ($enclosure = $item->get_enclosure()): ?>
<div>
<?php echo $enclosure->native_embed(array(
// New 'mediaplayer' attribute shows off Flash-based MP3 and FLV playback.
'mediaplayer' => '../demo/for_the_demo/mediaplayer.swf'
)); ?>
</div>
<?php endif; ?>
<p class="footnote"><a href="<?php echo $source; ?>"><?php echo $item->get_date('M j Y @ g:i a'); ?></a></p>
<div class="chunk_border">Â </div>
</div>
<?php endforeach; ?>
</div>
</div>