Wednesday September 08, 2004
All
|
General
|
Yesterday, I created a RSS feed in our BBS. The template was got form nytimes. It is pretty simple and straight forward (compare to the others using rdf). Below is the file structure: <?xml version="1.0" encoding="iso-8859-1" ?>
<rss version="2.0">
<channel>
<title>...</title>
<link>...</link>
<description>...</description>
<copyright>...</copyright>
<language>...</language>
<lastBuildDate>...</lastBuildDate>
<item>
<title>...</title>
<link>...</link>
<description>...</description>
<author>...</author>
<pubDate>...</pubDate>
<guid isPermaLink="false">...</guid>
</item>
<item>
...
</item>
</channel>
</rss>I hacked into the post.cgi, updated the rss file when a new post coming by
Both lastBuildDate and pubDate need to be a RFC 822 compliant date format, like use Time::gmtime;
$gm = gmtime(time);
$weekday = (qw(Sun Mon Tue Wed Thu Fri Sat Sun))[$gm->wday()];
$month = (qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec))[$gm->mon()];
$date = sprintf("%s, %02d %s %d %02d:%02d:%02d GMT", $weekday, $gm->mday(),
$month, $gm->year() + 1900,
$gm->hour(), $gm->min(), $gm->sec());
The guid field value need to be globally unique. So I combine the site URL and the current time together to make it a really GUID. I downloaded a RssReader to verify my work. It works very well. I also found a useful site that can verify whether your feed is valid. September 08, 2004 09:29 AM PDT Permalink Comments:
Post a Comment: Comments are closed for this entry. |
Calendar
Links
NavigationReferersToday's Page Hits: 1 |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
