Email conversation
From | Abhimanyu Chirimar |
To | Me |
Subject | integrating rss feed upon page-load instead of clicking 'go' |
Date | 20 December 2006 01:26 |
Hello,
I would like to include your rss parser script in a bunch of pages on a
website and have it load a rss feed and only display the titles quite
simply like this
<h2>News</h2>
<ul>
<li>Title1</li>
<li>Title2</li>
</ul>
Could you please guide me and help me set this up? Thank you.
Regards,
Abhimanyu Chirimar
From | Me |
To | Abhimanyu Chirimar |
Subject | Re: integrating rss feed upon page-load instead of clicking 'go' |
Date | 21 December 2006 20:43 |
Abhimanyu,
> I would like to include your rss parser script in a bunch of pages on a
> website and have it load a rss feed and only display the titles
The demo page has information about automating it without using a form.
http://www.howtocreate.co.uk/tutorials/jsexamples/rss.html
As for showing only the title, the line that starts with this is the part
that creates the new markup: 'document.title', upto '//output'.
You probably want to remove all of that, and replace it with the simple code
of your choice. You probably want to make a loop like this:
var oFeedStr = '<ul>';
for( var x = 0, y; y = newsItems[x]; x++ ) {
... code goes in here ...
}
oFeedStr += '<ul>';
The code you want to use should probably be something like this:
oFeedStr += '<li>'+prepHTMLCode(y['title'])+'</li>';
You may also want to use the links (otherwise they are just titles with no
link):
oFeedStr += '<li><a href="'+y['links']['alternate']+'">'+
prepHTMLCode(y['title'])+'</a></li>';
Mark 'Tarquin' Wilton-Jones - author of http://www.howtocreate.co.uk/