PDA

View Full Version : RSS Feed


chilipie
11-28-2004, 08:07 PM
Here's the lowdown: I want to have this feed (http://news.bbc.co.uk/rss/newsonline_world_edition/technology/rss091.xml) in my site. I know sod all about XML and RSS - so if you can help remember to treat me like a moron :p .

gsnedders
11-28-2004, 08:10 PM
Got any server side languages?

chilipie
11-28-2004, 08:13 PM
PHP. Bugger, I've got to have a message at least five... Hey I've done it :) .

chilipie
11-28-2004, 10:15 PM
Sorted. I'm using a thing called CaRP (http://www.geckotribe.com/rss/carp/). Thanks anyway.

chilipie
11-29-2004, 04:39 PM
Actually, I've got some more questions.
1. Can I just have, say, the first 6 entries from a feed, and if so how?
2. How do I set up a feed eg. for a blog?

Skyzyx
11-29-2004, 10:24 PM
Well, I'm not sure about other blogging CMS's, but in Movable Type, you could take a look at my RSS 2.0 template:


<?xml version="1.0" encoding="<$MTPublishCharset$>"?>
<?xml-stylesheet href="/css/xhtml-rss.xsl" type="text/xsl"?>
<rss version="2.0"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
xmlns:admin="http://webns.net/mvcb/"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">

<channel>
<title><$MTBlogName remove_html="1" encode_xml="1"$></title>
<link>http://www.skyzyx.com/</link>
<description><$MTBlogDescription remove_html="1" encode_xml="1"$></description>

<dc:language>en-us</dc:language>
<copyright><MTEntries lastn="1">Copyright (c) 2002-<$MTEntryDate format="%Y"$>, Ryan Parman</MTEntries></copyright>
<dc:date><MTEntries lastn="1"><$MTEntryDate format="%Y-%m-%dT%H:%M:%S"$></MTEntries></dc:date>
<pubDate><MTEntries lastn="1"><$MTEntryDate format="%a, %d %b %Y %H:%M:%S"$> PDT</MTEntries></pubDate>

<managingEditor>Ryan Parman</managingEditor>
<webMaster>Ryan Parman</webMaster>
<generator>Movable Type <$MTVersion$></generator>
<admin:generatorAgent rdf:resource="http://www.movabletype.org/?v=<$MTVersion$>" />
<docs>http://blogs.law.harvard.edu/tech/rss</docs>

<rating>(pics-1.1 "http://www.icra.org/ratingsv02.html" comment "ICRAonline EN v2.0" l gen true for "http://www.skyzyx.com" r (nz 1 vz 1 lz 1 oz 1 cz 1) "http://www.rsac.org/ratingsv01.html" l gen true for "http://www.skyzyx.com" r (n 0 s 0 v 0 l 0))</rating>

<sy:updatePeriod>hourly</sy:updatePeriod>
<sy:updateFrequency>1</sy:updateFrequency>
<sy:updateBase>2000-01-01T12:00+00:00</sy:updateBase>
<ttl>60</ttl>

<image>
<title>Skyzyx.com: Advocacy, Evangelism, and Propaganda for Standards-Compliant Design.</title>
<url>http://www.skyzyx.com/img/banner88x31.gif</url>
<link>http://www.skyzyx.com/</link>
<width>88</width>
<height>31</height>
</image>
<MTEntries lastn="5">

<item>
<title><$MTEntryTitle remove_html="1" encode_xml="1"$></title>
<link><$MTEntryLink encode_xml="1"$></link>
<guid isPermaLink="true"><$MTEntryLink encode_xml="1"$></guid>
<description><$MTEntryBody encode_xml="1"$></description>

<dc:subject><$MTEntryCategory remove_html="1" encode_xml="1"$></dc:subject>
<category><$MTEntryCategory remove_html="1" encode_xml="1"$></category>

<dc:date><$MTEntryDate format="%Y-%m-%dT%H:%M:%S"$></dc:date>
<pubDate><$MTEntryDate format="%a, %d %b %Y %H:%M:%S"$></pubDate>

<author>Ryan Parman</author>
<comments><$MTEntryLink encode_xml="1"$>#comments</comments>
</item>
</MTEntries>
</channel>
</rss>


The key is with <MTEntries lastn="5">.

I believe that me' (http://www.codingforums.com/member.php?u=4134) uses WordPress, and I'm not sure what mindlessLemming (http://www.codingforums.com/member.php?u=9925) uses.

And although you've already decided to go with CaRP, I just wanted to toss out there that I've been working hard on an RSS/Atom parser called SimplePie (http://www.skyzyx.com/projects/simplepie/). I've worked very hard on two things: speed, and ease of use. I believe that mindlessLemming is using it in one of his projects. Perhaps he can give some non-biased feedback on it.

gsnedders
11-30-2004, 01:31 AM
Andrew (mindlessLemming) also uses WordPress, as for SimplePie, I've been finding it easy to use... No finished product... Yet...

Scrowler
11-30-2004, 04:42 AM
server side languages such as php are capable of breaking up files into different sections, if you wanted to use php to display 5 records from your file, look up the explode() function and array() function

chilipie
11-30-2004, 08:16 AM
Tnaks I'll have a go with WordPress later - I installed it yesterday. SimplePie looks good as well.