More than 1 rss feed on my site?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
sebfck
Forum Newbie
Posts: 1
Joined: Sat Oct 22, 2005 5:46 am

More than 1 rss feed on my site?

Post by sebfck »

feyd | Please use

Code: Select all

and

Code: Select all

tags where appropriate when posting code. Read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]


Hey,

Is it possible to have more than one RSS feed on my website. Because when i try putting 2 of this code in, it only shows the first RSS FEED

[b]Code:[/b]

Code: Select all

<?
require('magpierss-0.71.1/rss_fetch.inc');
$rss = fetch_rss('http://nyhederne.tv2.dk/rss/nyhederne.xml');
$num_items = 5;
$items = array_slice($rss->items, 0, $num_items);

        foreach ($items as $item) {
        $title = $item['title'];
        $href = $item['link'];
        $description = str_replace('','',$item['description']);
		echo "<li><a href=$href>$title</a>".$item['description']."</li>"
;
        }
?>

The SECOND code i put in is this

Code:

Code: Select all

<?
require('magpierss-0.71.1/rss_fetch.inc');
$rss = fetch_rss('http://www.dr.dk/Forms/Published/rssNewsFeed.aspx?config=4cdd8bff-48a5-461c-a848-f553db411d4c&rss=Yes&rssTitle=DR+Nyheder+Online+-+Alle+nyheder&overskrift=Alle+nyheder+-+24+timer&Url=%2fnyheder%2f');
$num_items = 5;
$items = array_slice($rss->items, 0, $num_items);

        foreach ($items as $item) {
        $title = $item['title'];
        $href = $item['link'];
        $description = str_replace('','',$item['description']);
		echo "<li><a href=$href>$title</a>".$item['description']."</li>"
;
        }
?>
But it only shows the first RSS feed.

How can i show both?

/Sebastian


feyd | Please use

Code: Select all

and

Code: Select all

tags where appropriate when posting code. Read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

when and where do you call the second one in relation to the first?
Post Reply