Posted by Craig Storey on 07/09/07 16:36
musicpro64@gmail.com wrote:
> I am having a problem calling more than one instance of the magpie rss
> code on a php page (one single instance can be used to display one
> feed... if I try to display two feeds on a page it crashes). Has
> anyone had success displaying more than one feed on a page with
> magpie???? if not, any suggestions as to code that might do the
> job..; I would really appreciate any advice. Have been fighting with
> this code for days!
>
> Thanks
>
Yes, I've used MagpieRSS to output multiple feeds on a single page.
Maybe check that the feeds you are using aren't causing the problem. I
would attempt to validate them to see if there are issues there.
Anyway, what I do to display multiple feeds is...
require_once( './magpierss/rss_fetch.inc' );
// Feed #1...
$out = '<h4>XCOttawa</h4><ul>';
$url = 'http://www.xcottawa.ca/rss.php';
$rss = fetch_rss($url);
foreach ($rss->items as $item )
{
$out .= '<li><a href="' . $item['link'] . '" target="_blank">' .
$item['title'] . '</a></li>' . "\n";
}
$out .= "</ul>";
// Feed #2...
$out. = '<h4>CBC - FIFA U20</h4><ul>';
$url = 'http://rss.cbc.ca/lineup/specialsports-fifau20worldcup2007.xml';
$rss = fetch_rss($url);
foreach ($rss->items as $item )
{
$out .= '<li><a href="' . $item['link'] . '" target="_blank">' .
$item['title'] . '</a></li>' . "\n";
}
$out .= "</ul>";
echo $out;
Navigation:
[Reply to this message]
|