Abhimanyu Chirimar

Navigation

Skip navigation.

Search

Site navigation

Email conversation

FromAbhimanyu Chirimar
ToMe
Subjectintegrating rss feed upon page-load instead of clicking 'go'
Date20 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
FromMe
ToAbhimanyu Chirimar
SubjectRe: integrating rss feed upon page-load instead of clicking 'go'
Date21 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/
This site was created by Mark "Tarquin" Wilton-Jones.
Don't click this link unless you want to be banned from our site.