Email conversation
From | Andy Dillbeck |
To | Me |
Subject | modifying RSS script to allow for it to only display one article, then going on to the next one |
Date | 23 May 2005 23:13 |
I'm really excited about the RSS feed, but I'm not sure how to make it
do exactly what I want it to. basically, I want to have it display
article 1 from a RSS feed, and then 3 seconds later switch to article 2,
and so on till it gets to the end and flips back around to 1. any ideas
you have would be awesome.
Andy
From | Andy Dillbeck |
To | Me |
Subject | modifying RSS script to allow for it to only display one article, then going on to the next one |
Date | 24 May 2005 22:55 |
hope this doesnt get annoying but after playing around with it for a
little bit, I can see a possible sollution, and another hangup.
since the rss parcer script puts everything into an array, and your
scrolling text script reads everything from an array, I figured this
would be a possible sollution.
the problem I run into is that the script runs on load, and I'm trying
to figure out how to get it to wait till after the rss import finishes
and is able to fill the scroller array before triggering a
windows.onload. sadly, I also cant seem to figure out how to get it to
run without the onload in there (IE. trigger it after I know that the
RSS has finished.)
thanks for your patience
Andy
From | Me |
To | Andy Dillbeck |
Subject | Re: modifying RSS script to allow for it to only display one article, then going on to the next one |
Date | 25 May 2005 11:06 |
Andy,
> since the rss parcer script puts everything into an array, and your
> scrolling text script reads everything from an array, I figured this
> would be a possible sollution.
Indeed, this was what I was going to suggest.
> the problem I run into is that the script runs on load, and I'm trying
> to figure out how to get it to wait till after the rss import finishes
> and is able to fill the scroller array before triggering a
> windows.onload.
Sadly, you cannot delay window.onload.
However, you could stop your scroller from starting onload, and tell it to
run using my parser instead.
So instead of
window.onload = yourfunction;
(or however it is triggered), you can replace everything in my parser
function after this line:
"//now that the entire feed has been converted into JavaScript arrays, it
is time to write it out"
with a call to your scroller's function:
yourfunction();
Mark 'Tarquin' Wilton-Jones - author of http://www.howtocreate.co.uk/
From | Andy Dillbeck |
To | Me |
Subject | Re: modifying RSS script to allow for it to only display one article, then going on to the next one |
Date | 25 May 2005 17:45 |
Thanks for your ideas, but its still giving me troubles. Here is what I did.
I got rid of the onload part from the scrollmsg.js:
"//window.onload=function (){for(varx=0;x<MWJScrollers.length;x++){rotMsg(0,0,x);}}"
The parser now says:
"//now that the entire feed has been converted into JavaScript arrays, it is
time to write it out
for( var x = 0, y; y = newsItems[x]; x++ ){
NewsArray[x]='<ahref="'+newsItems[x]['link']+
'">'+(newsItems[x]['title']?newsItems[x]['title']:'Untitiled')+'<\/a>';
}
runScroll();"
And the body contains:
<body>
<script type="text/javascript" language="javascript1.2"><!--
if(window.myInterval){
window.clearInterval(window.myInterval);
}
if(importRSS('rssLocal.php?feedURL='.../blabla.xml'),'parseRSS',false,2000))
{
if(parseFloat(0))
{
window.myInterval=window.setInterval('importRSS(\'rssLocal.php?feedURL='+
escape('.../blabla.xml')+'\',\'parseRSS\',false,2000);',parseFloat(0)*60000);
}
}
else
{
alert('Your browser cannot import XML, so it cannot view RSS feeds using '+
'this script');
}
var myScrollerThing = new msgScroller(
152, //height of the scroller (the scrolling part of it, not the border)
170, //width of the scroller (the scrolling part of it, not the border)
50, //height required by the text in the scroller, usually about 20 per line
//(if the text wraps onto the line beneath it, you will need 40 etc.)
0, //thickness of the border around the scroller
'#ff0000', //colour of the border around the scroller
75, //scrolling delay - 75 is about right
3000, //pause time (set to same as scrolling delay for no pause)
0, //distance from the top that you want the scroller to pause
'#0000ff' //background colour for the scroller
);
function runScroll(){
//using alerts I've confirmed that MWJScrollers has a length of 1 at this point.
for(x=0;x<NewsArray.length;x++){myScrollerThing.msgArray[x]=NewsArray[x];}
//NewsArray is global, and I've used alerts to confirm that the values are
// getting put into the scroller array
myScrollerThing.buildScroller();
//at this point MWJScrollers is undefined.
for( var x = 0; x < MWJScrollers.length; x++ ) {
rotMsg( 0, 0, x );
}
}
--></script>
</body>
And I get nothing. I havent changed the scrollmsg.js except to comment out
the onload.
Here is the page that I'm playing with it on:
[URL]
From | Me |
To | Andy Dillbeck |
Subject | Re: modifying RSS script to allow for it to only display one article, then going on to the next one |
Date | 25 May 2005 23:17 |
Andy,
> Thanks for your ideas, but its still giving me troubles.
My scrollers should be capable of dynamically changing the messages like
this, so I am a little bit confused. I guess I really need to see it (not)
in action to work out what is going wrong. Unfortunately, your test page is
returning a blank document that never completes loading, so I cannot see it.
Is your server having problems?
Cheers
Tarquin
From | Andy Dillbeck |
To | Me |
Subject | Re: modifying RSS script to allow for it to only display one article, then going on to the next one |
Date | 26 May 2005 15:53 |
Attachment | zip file containing all relevant files |
Here are the files. Easier than looking on our server.
I don't think the server is having trouble, but maybe I goofed something on
the file up so that it hangs up on load?
Always hated infinate loops or whatever.
Andy
From | Me |
To | Andy Dillbeck |
Subject | Re: modifying RSS script to allow for it to only display one article, then going on to the next one |
Date | 26 May 2005 23:37 |
Attachment | corrected version of the page |
Andy,
> Here are the files. Easier than looking on our server.
got the problem :)
Even though you want to fill up the scroller after importing the XML, you
still need to create the scroller while the page is still loading. You can
fill it up later. I have ammended the page, and attached a fixed version -
with a few other optimisations - see the comments I added.
Tarquin
From | Andy Dillbeck |
To | Me |
Subject | Re: modifying RSS script to allow for it to only display one article, then going on to the next one |
Date | 31 May 2005 16:25 |
Thats awesome man. Thank you so much for all your help, and for the script
in the first place :)
Andy