View Full Version : Ultimate Fade-in slideshow 2.0 - substitute imagearray for another array variable

01-06-2014, 06:42 PM
I am using Ultimate Fade-in Slideshow v 2.0 and need to substitute my own image array but have not found the correct syntax to make it work.
I have a directory of images that I'm reading with PHP and then splitting those images into two arrays (for the Left side and the Right side because I have two slideshows on the same page).
The code below is only for the left slideshow; I know how to make the other one separate.
I have not included the PHP code for getting the filenames ($banner) because it already works. I have included the creation of the JS array in case anyone else would like to use this code.
However, my problem is simply using my JS array as a variable for the imagearray. I have tried all kinds of syntax, to no avail.

I currently have a document.write turned on to show the results of the array variable I want to use and the test page is http://www.roseritchieacademy.com/indexTEST.php.
The variable array is this:

["images/banner/!headerLeft.jpg", "", "", ""],["images/banner/1.jpg", "", "", ""],["images/banner/11.jpg", "", "", ""],["images/banner/13.jpg", "", "", ""],["images/banner/15.jpg", "", "", ""],["images/banner/3.jpg", "", "", ""],["images/banner/5.jpg", "", "", ""],["images/banner/7.jpg", "", "", ""],["images/banner/9.jpg", "", "", ""]

<script language="JavaScript" type="text/JavaScript">

// Find out how many photos are in the array
var BannerCount = <?php echo count($banner); ?>;
// Put PHP array into a Javascript Array
var aBanner= new Array(BannerCount);
for($i=0; $i < count($banner); $i++){
$MyJava = "aBanner[".$i."] = '" . $banner[$i] . "';"; // develop the JS
echo $MyJava; // write the JS to browser

var imagearrayL = new Array(); // Set up array needed for slideshow
var imagearrayR = new Array(); // Set up array needed for slideshow
// Add each photo to one of the arrays
for(i=0; i<=BannerCount-1; i++) // For each record in banner array
var $BannerPic = '["images/banner/' + aBanner[i] + '"]'; // put banner pic into JS variable
if(i % 2 == 0) { //If pic number is even (modulus remainder 0)
imagearrayL.push($BannerPic); // put it in the Left Array
else { //If pic number is odd, put it in the Right Array
imagearrayR.push($BannerPic); // put it in the Left Array

var mygallery=new fadeSlideShow({
wrapperid: "fadeshow1", //ID of blank DIV on page to house Slideshow
dimensions: [266, 200], //width/height of gallery in pixels. Should reflect dimensions of largest image

imagearray: imagearrayL, // THIS IS THE LINE THAT IS NOT WORKING ***************************************

displaymode: {type:'auto', pause:2500, cycles:0, wraparound:false},
persist: false, //remember last viewed slide and recall within same session?
fadeduration: 600, //transition duration (milliseconds)
descreveal: "ondemand",
togglerid: ""
alert ('Javascript is finished and was not broken.');

01-11-2014, 02:05 AM
Use the Chrome browser. In it view the problem page. Press Ctrl - U to see how the page is being served. Press F12 to open developer tools and hit the console tab to see any errors that are being reported.

If you want more help, please include a link to the page on your site that contains the problematic code so we can check it out.