Quantcast
Viewing latest article 1
Browse Latest Browse All 2

Answer by Andrew for Displaying Multiple RSS Feeds with PHP

It seems that you have two problems: aggregating multiple RSS feeds and then displaying them in a list.

1: Use SimplePie lib -- probably the simplest and best one for anything related to RSS. Might seem as an overkill for someone because of the file size, but anyway. It will also handle sorting by date for you. http://simplepie.org/

<?php$feed = new SimplePie();$feed->set_feed_url(array('http://rss1', 'http://rss2'));$feed->init();$feed->handle_content_type();foreach($feed->get_items(0, 100) as $item) {    $n = array_search($item->get_feed(), $feeds);    echo '<li class="feed'.$n.'">'.$item->get_title().'</li>';}?>

2: What akamike said (and deleted?), but list style images can be a pain -- almost impossible to align. A more flexible solution would be to remove them and use background.

CSS:

li.feed1, li.feed2 {    list-style: none;    background-position: left center;    background-repeat: no-repeat; }li.feed1 { background-image: url(feed1icon.png); }li.feed2 { background-image: url(feed2icon.png); }

Viewing latest article 1
Browse Latest Browse All 2

Trending Articles