Mark Keys

Navigation

Skip navigation.

Search

Site navigation

Email conversation

FromMark Keys
ToMe
SubjectRSS Atom feed parser - with out submit?
Date10 March 2006 21:55
Hi Tarquin,

First you have an amazing site of amazing detail and information.
I just cant believe that ive never come across it via a search engine
before.

Its fantastic and how you make it all look so simple.

I came across your RSS/Atom feed parser
<http://www.howtocreate.co.uk/jslibs/script-rssatom>  
And its amazing.
Its something ive never gotten into but with the help from your site,

You have made RSS a real eye opener.
And with some guidance from your self if you don't mind,

I would like to tweak your code to achieve the following if it's possible.

The parse feeder is great but is it possible to make it work with out the
"Form" ?

As I have read in your e-mail section where people have had the answers from
yourself, 

Sent to them in the form of a zip, so I wasn't able to understand how it was
achieved.

The Goal Simply.

To have the Scroller to begin when the page loads, (Well a little pause).
to obtain the XML pages from an Array,

And to loop through the array for a X period of time.

I am writing to you as yes a short cut but I have read and read your site,

And tried my best with the code with out success.

I can't get the values to pass over to php with success.

Well poorly, when I open the page the xml just spews out in to the page.
And the scroller window does nothing.

I suspect the problem is that the POST is being sent to the browser and then
the javascript 

Is using that to complete the functions. 

I'm having problems understanding the line of code attached to the form
onsubmit="if(window.myInt....

As its that I believe  holds the key to being able to use the RSS without
the submit / form.

Can you help?

As ive got my teeth in to this, and would love to understand more and learn
from it too.

Thanks in advance, for your time, and a cracking site, I will visit time and
time again.

Mark Keys.
FromMe
ToMark Keys
SubjectRe: RSS Atom feed parser - with out submit?
Date15 March 2006 09:21
Mark,

> The parse feeder is great but is it possible to make it work with out the
> "Form" ?

yep. remove the form and call this manually:
importXML('rssLocal.php?feedURL='+escape(URL),'parseRSS',false,5000)
(where URL is the URL of your feed)

> To have the Scroller to begin when the page loads, (Well a little pause).
> to obtain the XML pages from an Array,

var feedArray = [
  'http://example.com/feed1.xml',
  'http://example.com/feed2.xml',
  'http://example.com/feed3.xml',
  'http://example.com/feed4.xml' //no comma on the last one
];
var counter = 0;
function nextfeed() {
   var URL = feedArray[counter];
   counter++;
   counter = counter % feedArray.length;
   importXML('rssLocal.php?feedURL='+escape(URL),'parseRSS',false,5000);
}
nextfeed();
setInterval(nextfeed,120000); //every two minutes, change feed

> I'm having problems understanding the line of code attached to the form
> onsubmit="if(window.myInt...

That line reloads the current feed, it does not load other feeds. What I
have given you will also reload the current feed if you want. Just put only
one feed address in the array.


Mark 'Tarquin' Wilton-Jones - author of http://www.howtocreate.co.uk/
FromMark Keys
ToMe
SubjectRe: RSS Atom feed parser - with out submit?
Date15 March 2006 10:38
Thank you so much for the code below,
I will do as you recommend.

You make this coding seem so easy,
Which I doubt it is.

You have a great site and ive got your RSS feed on my
Desktop pc so I can keep up to date with you and your site.
You are one of the very few out there that takes the time
To reply and actually help, a trait that is very rare indeed.

Hopefully the code will slide in with out any problems,
That's a million again.

Mark.
FromMark Keys
ToMe
SubjectRe: RSS Atom feed parser - with out submit?
Date15 March 2006 11:38
HI Tarquin,
Its not working ?

Its down to where I'm putting things I'm sure...

> remove the form and call this manually:
> importXML('rssLocal.php?feedURL='+escape(URL),'parseRSS',false,5000)

Ive removed all the form elements and form tags.
I tried to paste the above line in its place but just shows as text.
So I pasted it in the header with the rest of the code.

Ive used the same feeds just for testing purposed I understand how they
work.

How do I call it manually, & Which file /s should they be copied into.

Thanks again for your help,
It is very, very much appreciated. Thanks.

----- Snipit of the top of my code..---------
rssscroller.html

[snip.]
importXML('rssLocal.php?feedURL='+escape(URL),'parseRSS',false,5000);

var feedArray = [
    'http://news.bbc.co.uk/rss/newsonline_uk_edition/front_page/rss091.xml',
    'http://news.bbc.co.uk/rss/newsonline_uk_edition/front_page/rss091.xml',
    'http://news.bbc.co.uk/rss/newsonline_uk_edition/front_page/rss091.xml',
    'http://news.bbc.co.uk/rss/newsonline_uk_edition/front_page/rss091.xml'
//no comma on the last one
];
var counter = 0;
function nextfeed() {
    var URL = feedArray[counter];
    counter++;
    counter = counter % feedArray.length;
    importXML('rssLocal.php?feedURL='+escape(URL),'parseRSS',false,5000);
}
nextfeed();
setInterval(nextfeed,120000); //every two minutes, change feed

function cloneTree(oFrom,oTo) {
	for( var i = 0, n; i < oFrom.childNodes.length; i++ ) {

etc.
FromMe
ToMark Keys
SubjectRe: RSS Atom feed parser - with out submit?
Date15 March 2006 11:51
Mark,

You need to call it _after_ the page loads (remember that the onload event
can only be used by one function, so if something else is also listening for
the onload event, it will fail).

Remove the changes you have made.

Now, in the HTML page, add this:

<script type="text/javascript">
var feedArray = [
    'http://example.com/feed1.xml',
    'http://example.com/feed2.xml',
    'http://example.com/feed3.xml',
    'http://example.com/feed4.xml' //no comma on the last one
];
var counter = 0;
function nextfeed() {
  var URL = feedArray[counter];
  counter++;
  counter = counter % feedArray.length;
  importXML('rssLocal.php?feedURL='+escape(URL),'parseRSS',false,5000);
}
window.onload = function () {
  nextfeed();
  setInterval(nextfeed,120000); //every two minutes, change feed
};
</script>


If that fails, please put your page online, and send me the address of it so
I can see what the problem is :)
FromMark Keys
ToMe
SubjectRe: RSS Atom feed parser - with out submit?
Date15 March 2006 12:13
I am not worthy,
That works a treat Tarquin,

Its an amazing piece of script and credits where credits are due :)
Your site is a jam packed with info and help.
Thank you very very much for your time and patcients,
It is very much appreciated.

You have me fascinated with JavaScript now,
Its something that I will begin to study,
once I get my head around PHP...

Keep up the good work.
And have a nice day, I know I will now.

Cheers Mark.

P.s.
Thanks again.
This site was created by Mark "Tarquin" Wilton-Jones.
Don't click this link unless you want to be banned from our site.