Dynamic Drive slideshow script with CMSB

20 posts by 4 authors in: Forums > CMS Builder
Last Post: March 1, 2013   (RSS)

Thanks, Ron. Turns out I'd actually misnamed an array, which Greg corrected for me.

http://www.masselsmarine.com/index-slideshow-cms_005.php

Try something like this for the trailing comma in the head section,

<script>
        window.addEvent('domready', function(){
            
            
            var data = { <?php $blank = "'" ?><?php
    $output = '';
     if ($home_page_slidesRecord['randomize_images']== 1) {shuffle($home_page_slidesRecord['images']) ;}
    foreach ($home_page_slidesRecord['images'] as $upload) {
        
      $output .= "'". $upload['thumbUrlPath3']. "'". ": { caption: " ."'4'"." }" . ",";
    }
    $output = rtrim($output,","); // remove trailing comma
    print $output;
?>

The format for $output is what my slide show requires. Change to suit. The 4 is a dummy required value.

There are other slide show recipes that I've converted to use with CMSB in my CMSB Cookbook http://www.thecmsbcookbook.com

Hope that helps.

Jerry Kornbluth

The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php

Hi, Greg.  

My client noticed that while the slideshow works in Firefox and Chrome, it doesn't in IE: http://www.masselsmarine.com/index-slideshow-cms.php. Any idea why, please?  

Cheers,

Nigel

Hi Nigel,

I couldn't get your link to work.

However, unless you've got some specific requirement for the show that requires the one you're using, I've been using SLIDESHOW II - A JAVASCRIPT CLASS FOR MOOTOOLS  http://www.electricprism.com/aeron/slideshow/ for quite a while and there's a recipe for CMSB implementation in my CMSB cookbook http://www.thecmsbcookbook.com.

It should be pretty east to use the same editors that you've already set up and I've never had a complaint.

Hope that helps,

Jerry Kornbluth

The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php

Hi Nigel,

The problem is with Internet Explorers really strict JavaScript validation. The final image in your JavaScript array of images has a comma at the end. I did try to set up an if statement at the end of the code to stop it putting a comma on the final item (<?php if(++$i != $numItems){ echo ','}; ?>), but it doesn't appear to be working. I think this is because the count function isn't counting the correct array of items. 

You will need to amend this line of code:

$numItems = count(@$homepage_slideshow['slideshow']);

So that it is counting the correct array, it needs to count the same array as is used in the foreach loop to create the images.

If you have any trouble making the changes, could you post your new slideshow code into a post for me? Then I can explain the exact changes you need to make. 

Thanks!

Greg

Greg Thomas







PHP Programmer - interactivetools.com

I am using that script on multiple websites and have tested them with all major browsers and android tablet.  Never had anyone say it didn't work but I am not surprised that the failure is with IE.  Did he say what version?  I have only tested with IE7, 8, 9.

Ron Conring
Conring Automation Services
----------------------------------------
Software for Business and Industry Since 1987

It doesn't work for me in IE either, and I'm running 8.0.6001.18702 on Windows XP Professional.

Thanks, Jerry. For now, I'm going to try to amend the version that Greg has been working on for me before I try an alternative.

By CommonSenseDesign - March 1, 2013 - edited: March 1, 2013

Hi, Greg.

Thanks for your advice. Implementing your solution turned out to be pretty easy. All I did was change

$numItems = count(@$homepage_slideshow['slideshow']);

to

$numItems = count(@$homepage_slideshow['content']);

Now the slideshow seems to be working perfectly in IE, Firefox and Chrome: www.masselsmarine.com

Thanks again for your help and patience.