PDA

View Full Version : update contents of featured content slider 2.4 on each rotation



pixelrow
08-18-2008, 05:29 PM
1) Script Title: featured content slider 2.4

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex17/featuredcontentslider.htm

3) Describe problem: I have my slider set up to use the external list of contents which in my case are four png chart imagess. The slider is working fine and rotates through my four charts.

you can see the current slider which is basically a widget here:

http://www.futurescloud.com/widgets/futurescloud/futurescloud-forex-aud-rtw.html

I need help using the "onChange" function to instruct the slider to go out and get fresh contents on each rotation since the chart images are actually being updated each minute and I want the slider always to show the latest availabe chart, not the one it first found maybe a few minutes earlier.

Using the example provided I got the idea to use the command "else if (previndex==3)" like this

<script type="text/javascript">
featuredcontentslider.init({
id: "slider-forex-aud", //id of main slider DIV
contentsource: ["ajax", "/../../futurescloud-content/charts-forex-aud-rtw.htm"], //Valid values: ["inline", ""] or ["ajax", "path_to_file"]
toc: "markup", //Valid values: "#increment", "markup", ["label1", "label2", etc]
nextprev: ["Previous", "Next"], //labels for "prev" and "next" links. Set to "" to hide.
enablefade: [true, 0.1], //[true/false, fadedegree]
autorotate: [true, 10000], //[true/false, pausetime]
onChange: function(previndex, curindex){
if (previndex==curindex) //if two indices point to the same slide (page first loads)
return //do nothing
else if (previndex==3)
--- need something to refresh the contents here
}

})
</script>


Could you please tell me what code I can insert to force the content slider to go out and retrieve the latest versions of the same four chart images by this method

If this method will not work can I refresh contents per rotation some other way?

Thank you for any assistance,

pixelrow

for your reference this is the content of the external file describing the 4 divs

<div class="contentdiv">
<a href="http://www.futurescloud.com/forex/" target="_blank"><img src="http://www.minicharts.mobi/AUD-CAD-300.png" alt="Real-Time FOREX Chart AUD-CAD
Click for the latest FOREX News, Opinions & Numbers at FuturesCloud.com" />
</div>

<div class="contentdiv">
<a href="http://www.futurescloud.com/forex/" target="_blank"><img src="http://www.minicharts.mobi/AUD-CHF-300.png" alt="Real-Time FOREX Chart AUD-CHF
Click for the latest FOREX News, Opinions & Numbers at FuturesCloud.com" />
</div>

<div class="contentdiv">
<a href="http://www.futurescloud.com/forex/" target="_blank"><img src="http://www.minicharts.mobi/AUD-JPY-300.png" alt="Real-Time FOREX Chart AUD-JPY
Click for the latest FOREX News, Opinions & Numbers at FuturesCloud.com" />
</div>

<div class="contentdiv">
<a href="http://www.futurescloud.com/forex/" target="_blank"><img src="http://www.minicharts.mobi/AUD-USD-300.png" alt="Real-Time FOREX Chart AUD-USD
Click for the latest FOREX News, Opinions & Numbers at FuturesCloud.com" />
</div>

ddadmin
08-20-2008, 02:43 AM
Using the onChange event handler for this probably isn't the best way, since you're assuming the user will always click on the final pagination link, which is what will trigger the re-downloading of the external contents. A better way is probably just to have the script do this based on the desired time interval, such as every 10 seconds. With that in mind, inside the .js file, find the following two lines:


if (setting.contentsource[0]=="ajax")
this.ajaxconnect(setting)

and replace them with the below instead:


if (setting.contentsource[0]=="ajax"){
this.ajaxconnect(setting)
setInterval(function(){
setting.contentdivs=[]
setting.toclinks=[]
setting.topzindex=0
featuredcontentslider.cleartimer(setting, window["fcsautorun"+setting.id])
featuredcontentslider.ajaxconnect(setting)
},10000
)
}

Where 10000 is the time interval between refetching of the original external contents file in milliseconds (so 10000=10 seconds). This should work.

pixelrow
08-21-2008, 06:16 PM
Thank you very much for the suggestion, let me explain the results

I replaced the code as suggested and experimented with the refresh timings on the slider and for the content refresh and determined that the refresh of content works but it kills the slider so the slider won't go to the next slide or otherwise respond

If I set the refresh fast to 5 seconds and the rotation speed slower to say 50 seconds then while on the first slide it refreshes every 5 seconds but the slider will not rotate to the next slide

If I set the refresh slow to like 50 seconds and the rotation fast to like 10 seconds then the slider makes it through my four slides and then dies when the refresh triggers so the slider won't start a second rotation

Here are the simple slider and the refresh slider if you want to see what I mean

http://www.futurescloud.com/widgets/futurescloud/futurescloud-forex-aud-w.html
http://www.futurescloud.com/widgets/futurescloud/futurescloud-forex-aud-rtw.html

Here is a sample of a single image refreshing arrangement I utilize elswhere and it's nice since there is no blink on the refresh, I thought with the slider I would achieve the same effect by integrating the slide rotation and refreshing

http://www.futurescloud.com/widgets/futurescloud/refresh-test.html

Thank you for the assistance so far, I am really clueless on this stuff

If you have any other suggestions it would be greatly appreciated.

Thanks

Joe

ddadmin
08-22-2008, 05:45 AM
I see what you mean. After tinkering with the code some more and failing, this looks like it's going to be more complex than I had originally thought. I'll try and revisit this thread in the weekend to take another stab. Or you may want to consider posting this in the DD Paid Help section (http://www.dynamicdrive.com/forums/forumdisplay.php?f=29) for someone to take a look at it full time.

pixelrow
08-22-2008, 09:36 PM
I actually came here to your support because the person I hired elsewhere has not been successful in tweaking the slider to work for my application.

I will go ahead and post a bounty over in your new Paid Help forum and let anyone come up with the solution.

Thanks,

Joe

lebelg
02-25-2010, 12:05 PM
Hi! I want the exact same thing done and just stumbled upon this forum today. Problem is, I need the solution today as wel! Can someone help me with it? I had a look at the js file, but I can't find the place where the slideshow starts over, so I can't insert any code telling the script to reload it's data.

Hope someone can help!