Dreamweaver is not to be trusted on syntax errors visa vis javascript or PHP. Test the page on a PHP enabled server. If there are still problems, give me a link to the page.
Note: I tested the code on my WAMP server and it worked flawlessly. Unfortunately I have no access to a live PHP server to publish a demo. Even if I did though, you wouldn't be able to see the PHP code. PHP code is executed server side. In my WAMP demo ufade.php file I have (along with the rest of the code and HTML for the slideshow - ./pics_bak/ is where I'm pulling my images from):
Code:
<script type="text/javascript">
var mygallery=new fadeSlideShow({
wrapperid: "slideshow",
dimensions: [213, 101],
<?php
function returnimages(){
$dirname = './pics_bak/';
$pattern = '#\.(jpg|jpeg|png|gif|bmp)$#i';
$files = array();
if($handle = opendir($dirname)){
while(($file = readdir($handle)) !== false){
if(preg_match($pattern, $file)){
array_push($files, "\t\t['" . $dirname . $file . "', '', '']");
}
}
closedir($handle);
}
return "\timagearray: [\n" . implode(",\n", $files) . "\n\t],\n";
}
echo returnimages();
?>
displaymode: {type:'auto', pause:8500, cycles:0, wraparound:false, randomize:true},
persist: false,
fadeduration: 2000,
descreveal: "ondemand",
togglerid: ""
})
</script>
Once the page is loaded with PHP enabled, if I use the browser's view source I see for that very same bit:
Code:
<script type="text/javascript">
var mygallery=new fadeSlideShow({
wrapperid: "slideshow",
dimensions: [213, 101],
imagearray: [
['./pics_bak/jag1.jpg', '', ''],
['./pics_bak/jag10.jpg', '', ''],
['./pics_bak/jag11.jpg', '', ''],
['./pics_bak/jag12.jpg', '', ''],
['./pics_bak/jag13.jpg', '', ''],
['./pics_bak/jag14.jpg', '', ''],
['./pics_bak/jag2.jpg', '', ''],
['./pics_bak/jag3.jpg', '', ''],
['./pics_bak/jag4.jpg', '', ''],
['./pics_bak/jag5.jpg', '', ''],
['./pics_bak/jag6.jpg', '', ''],
['./pics_bak/jag7.jpg', '', '']
],
displaymode: {type:'auto', pause:8500, cycles:0, wraparound:false, randomize:true},
persist: false,
fadeduration: 2000,
descreveal: "ondemand",
togglerid: ""
})
</script>
So, as I say, this must be run on a PHP enabled server, and Dreamweaver isn't (as far as I know) capable of interpreting the code the way a PHP enabled server does.
Do you have a PHP enabled server?
Bookmarks