Feed

RSS Syndication through JavaScript includes

"my own comatose blog", "http://www.scripting.com/rss.xml" => "Scripting News", "http://boingboing.net/rss.xml" => "boingboing", "http://diveintomark.org/xml/rss.xml" => "diveintomark", "http://www.livejournal.com/users/belvane/rss" => "LiveJournal: Belvane", "http://www.livejournal.com/users/calanya/rss" => "LiveJournal: Calanya" , "http://www.livejournal.com/users/ijon/rss" => "LiveJournal: Ijon", "http://www.livejournal.com/users/spoons/rss" => "LiveJournal: Spoons" ); ?>

To see the script in action, choose one of these fine RSS feeds:

or enter a URL :

To include the current RSS feed in your webpage, paste the following into your HTML:

This bit included with Javascript:

Source:

What's This?

The goal of this page is to help people who have sites hosted on servers where they can't add dynamic includes (such as LiveJournal?) include a dynamic version of someone else's news page, journal or blog in their pages. What it does require is that the blog or journal have an RSS page available.

Postscript: Asaf Bartov reports you can't include Javascript in your LiveJournal pages. Bummer.

An RSS page is a simple XML document listing the latest stories posted to a web site. It can be just titles and links (like the current LiveJournal rss pages, at http://www.livejournal.com/users/username/rss/, or on my own comotose blog, here. This page is sometimes called a feed, because you feed it to some aggregator.

Thanks:

  • I did this because Ijon asked me to.
  • This script uses code from Jonah for reading RSS feeds.

Source:

Feed is a script written in PHP (version 4). Here's the source for everything. Note that the code that does the "heavy lifting" (i.e, parsing the RSS) is from Jonah, which is GPL code.

  • feed.php and format_rss.php, the php scripts that write out the javascript include. It can also write out the RSS as straight HTML (pass it a value other than 'js' in it's 'out' parameter). It uses the following code:
  • headlines.php is taken directly from Jonah - this is the clever bit, which actually reads the RSS.
  • jsprint.php is a silly little class for outputting text with document.write() commands.
  • A lot of sites (mostly weblogs updated with tools like Radio UserLand or Movable Type have a link to their RSS feed indicated in their headers with a LINK tag. You can grab that link and feed it to my script with this handy-dandy bookmarklet

Learn more: