Simple Example
(1)
(2)
(3)
(4)
(5)
(11)
(12)
(13)
(17)
(18)
(::Title::)
(19)
(::Pubdate::)
(20)
(21)
(::Description::)
(22)
(23)
(24)
(25)
(26)
Introduction
Firstly I must say, it makes more sense creating a script like this using a server-side language like PHP/ASP/.Net.
Obvious reasons being that a browser like firefox cant read remote files outside the host the script its being used (RSS feeds being remotely hosted most of the time) - if
you've got no concern with firefox users then this script is perfect for you (we hate you) - should work perfect reading rss from the
same host the scripts being used though. (Cronjob copying content to your site perhaps? haha)
One can however use this script in conjunction with a server-side script, for example, if firefox is detected, the
dynamic rss creation gets disabled giving the server control of rendering. (Which would be good practise, since javascript
wont always be available on all browsers)
But if you're looking for an ajax type rss solution, this is a good start
Code Description
(4) include the javascript file which processes the file.
(6) Attach a function to the load event of the page.
(8) Call Function ReadRSS (param1,param2,parm3):
param1: the location of the rss feed.
param2: the id of the template we're going to use to populate the body of the message.
param3: the id of the template we're going to use to pupulate the title of the feed.
(13,16) We use the data between this div tags to populate the assign a title to our feed, it functions like a template, (::Title::),
(::Link::) and (::Description::) being our bookmarks, same goes for line 17-24.
Pretty easy.
Firefox users
Apparently one cant read remote xml via firefox, the xml file needs to reside on the same machine as the script?