PDA

View Full Version : php array and ultimate fadein slideshow



ijyoung
03-09-2008, 12:05 PM
1) Script Title: Ultimate Fadein Slideshow

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex14/fadeinslideshow.htm

3) Describe problem: Cannot get array and script to talk to one another

I have studied the thread in http://www.dynamicdrive.com/forums/archive/index.php/t-10016.html
but no matter what I do I cannot get the combined scripts to work.

The php array works ok on testing separately.
I have tried all ways to get the script to work. Incorporate the php array into DD script, preload, all sorts but the two scripts don't talk to one another.
Following scripts are in the head:
<script type="text/javascript" src="./includes/getphotos2.php?preload"></script>
<script type="text/javascript" src="./includes/fadeslides.js"></script>

The php will be familiar,

<?php
// gethotos.php
$directory = "./../pics";

header("Content-Type: text/javascript");
$dir = opendir($directory);
for($i=0;$file = readdir($dir);$i++)
if(strpos($file, ".") === 0) {
$i--;
continue;
} else if(isset($_GET['preload'])) {
echo("(new Image()).src = '$directory/$file';\n");
} else echo("fadeimages[$i]=['$directory/$file', '', ''];\n");
?>

Obviously, I also have the javascript for fadeshow in the html.

However, I get error that fadeshow is not defined.
What have I done wrong?

Cheers

Ian

jscheuer1
03-09-2008, 03:24 PM
See:

http://www.dynamicdrive.com/forums/showthread.php?t=24777

ijyoung
03-09-2008, 04:27 PM
Thank you,

This has been a long and tortuous journey.
I have put both scripts in off page includes and works a treat.
See http://www.venachar-lochside.co.uk/photos.html

Ian