How to use RSS?

Reply

Join Date: Apr 2005
Posts: 32
Reputation: steven01 is an unknown quantity at this point 
Solved Threads: 0
steven01 steven01 is offline Offline
Light Poster

How to use RSS?

 
0
  #1
Dec 25th, 2005
Hi,I want to use RSS at my site.How to do so the contennent can be displayed at my site?This is the code:I want to use RSS at my site,how to do in dreamweaver?
This is the code:


Code:

<?xml version="1.0" encoding="ISO-8859-1" ?>
- <rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
- <channel>
<title>WeakGame Entertainment</title>
<link>weakgame.com</link>
<lastbuilddate>Sun, 25 Dec 2005 04:15:31 -0500</lastbuilddate>
<description>The latest posts on WeakGame.com</description>
<language>en-us</language>
- <item>
<title>No Santa</title>
<link>http://www.weakgame.com/?show=5594</link>
<description />
<dc:date>Sun, 25 Dec 2005 00:00:00 -0500</dc:date>
</item>
- <item>
<title>The "L" Word</title>
<link>http://www.weakgame.com/?show=5593</link>
<description />
<dc:date>Sun, 25 Dec 2005 00:00:00 -0500</dc:date>
</item>
- <item>
<title>Peter Griffin Christmas</title>
<link>http://www.weakgame.com/?show=5592</link>
<description />
<dc:date>Sun, 25 Dec 2005 00:00:00 -0500</dc:date>
</item>
- <item>
<title>Get Rid of Wifey</title>
<link>http://www.weakgame.com/?show=5585</link>
<description>A funny McDonalds commercial that shows us how to get rid of the wife</description>
<dc:date>Sun, 25 Dec 2005 00:00:00 -0500</dc:date>
</item>
- <item>
<title>Ref Knock-out</title>
<link>http://www.weakgame.com/?show=5560</link>
<description>Lucky this wasnt a championship match or else the red would be walking away with a belt around his waist.</description>
<dc:date>Sat, 24 Dec 2005 00:00:00 -0500</dc:date>
</item>
</channel>
</rss>
Reply With Quote Quick reply to this message  
Join Date: Feb 2002
Posts: 12,036
Reputation: cscgal is a glorious beacon of light cscgal is a glorious beacon of light cscgal is a glorious beacon of light cscgal is a glorious beacon of light cscgal is a glorious beacon of light cscgal is a glorious beacon of light 
Solved Threads: 128
Administrator
Staff Writer
cscgal's Avatar
cscgal cscgal is offline Offline
The Queen of DaniWeb

Re: How to use RSS?

 
0
  #2
Dec 25th, 2005
You need an RSS parser. There are many available, or you can easily write one yourself in not too much time, but one that I am particularly fond of is called MagpieRSS. You can get it at: http://magpierss.sourceforge.net/
Dani the Computer Science Gal
Follow my Twitter feed! twitter.com/daniweb
Reply With Quote Quick reply to this message  
Join Date: Apr 2005
Posts: 32
Reputation: steven01 is an unknown quantity at this point 
Solved Threads: 0
steven01 steven01 is offline Offline
Light Poster

Re: How to use RSS?

 
0
  #3
Dec 25th, 2005
sorry,I don't familiar with it.Can you give me some codes or how to do in dreamweaver?
Reply With Quote Quick reply to this message  
Join Date: Sep 2005
Posts: 1,073
Reputation: digital-ether is just really nice digital-ether is just really nice digital-ether is just really nice digital-ether is just really nice 
Solved Threads: 66
Moderator
digital-ether's Avatar
digital-ether digital-ether is offline Offline
Veteran Poster

Re: How to use RSS?

 
0
  #4
Dec 29th, 2005
Originally Posted by steven01
sorry,I don't familiar with it.Can you give me some codes or how to do in dreamweaver?
HI steven01

RSS is a way of syndicating site content.
The RSS file is an xml file with the RSS specification. That means its written to follow rules layed out for all RSS files. This allows any website or application to read the RSS file if it knows the RSS specification.

To use an RSS file, you have to have an application that will parse the RSS file.
This typically means, changing the xml in the RSS file, into HTML for display on your website.

So essentially what you have to do is:

1) know the RSS file location. http://somesite.com/rss.xml
2) Read the RSS files
3) Change each RSS tag ito a html tag.
4) Show this changes on your website.

So for example the xml:

[HTML]<item>
<title>No Santa</title>
<link>http://www.weakgame.com/?show=5594</link>
<description />
<dc:date>Sun, 25 Dec 2005 00:00:00 -0500</dc:date>
</item>[/HTML]

Can be parsed and show on your website as:

No Santa at Sun, 25 Dec 2005 00:00:00 -0500

- As you can see, the xml is just information, that you can display on your website. How you display this information, is up to you.

As for using dreamweaver.
Id go with using magpie: http://magpierss.sourceforge.net/
Or simply writing my own php code.
Dreamweaver id for formatting your code (making it easier to view), not writing code.

OK i'll write a simple php script to demonstrate how to read/parse RSS: (This is a very simple regex replacement, nothing standard)

This sample just lists the titles from an rss feed:

[PHP]<php

$rssUrl = "http://somesite.com/rss.xml"; // change this to the url of the rss file
$rss_array = file($rssUrl); // retrieve the file to an array
$rss = implode("\n", $rss_array); // implode the array to string

$titles = preg_match_all("/<title>(.*)</title>/", $rss, $matches); // match all the titles using a regex expression

// iterate through all matches
foreach ($matches as $title) {
echo $title[1]."<br />"; // display the title
}

?>[/PHP]

I havent tested the above code.
But it should clue you in.
preg_match_all is a regex expression (regular expression). You can seach google on that.
Last edited by digital-ether; Dec 29th, 2005 at 6:58 am. Reason: typo in code
www.fijiwebdesign.com - web design and development and fun
Cpanel Email - Let users Register email accounts on your website upon registration
Ajax Chat - Fully browser based chat!
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the PHP Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC