Image with link, changing regularly

4 posts by 2 authors in: Forums > CMS Builder
Last Post: August 22, 2009   (RSS)

Is there a way to have an image show, which includes a link, but which also changes every so many seconds?

I'm guessing, I'd just create a section in CMSB with an image upload and link, and have the coding to select from it.

As an addition to this, would there be a way to show images randomly?
High quality residential training for writers, actors & Film Making - Click Here for further information

Re: [Moonworks] Image with link, changing regularly

By Chris - August 22, 2009 - edited: August 22, 2009

Hi Moonworks,

You'd probably want to do this with JavaScript (I suppose it would be possible with Flash too.) There seem to be a lot of results if you [url http://www.google.ca/search?q=javascript+image+slideshow]google for javascript image slideshow[/url].

To get your image Urls (and captions, if desired) into JavaScript from PHP, you'll need to do something like this:

imageUrls = [];
captions = [];
<?php foreach ($newsRecord['upload'] as $upload): ?>
imageUrls.push("<?php echo addslashes($upload['urlPath']) ?>");
captions.push("<?php echo addslashes($upload['info2']) ?>");
<?php endforeach; ?>


You could, of course, use links instead of captions. The above code is meant to get multiple images out of one record, but if you want to set things up so that each record has one image, that's entirely possible too.

As Jerry Kornbluth mentioned in [url http://www.interactivetools.com/forum/gforum.cgi?post=73720#73720]another thread[/url], you may want to look into Milkbox http://reghellin.com/milkbox/ and SlideShowPro http://slideshowpro.net/

Best of luck! :D
All the best,
Chris

Re: [chris] Image with link, changing regularly

Thanks, Ill try out the code and take a loo at the other two sites.
High quality residential training for writers, actors &amp; Film Making - Click Here for further information