-
Okay, here's the link to the page I'm trying to get working: http://ohiobuttons.org/test/NewFadinSlideShow_1.html
Beverley. I tried putting it up as a .php page, but it displays a blank page. Also, I tried every combination I could think of using the examples you gave me. Nothing worked. I still haven't been able to get a hold of my server's tech support people. I'll keep trying.
-
At this stage I think you should go back to basics and confirm that the PHP is working for you. I've tested this code here and it works fine for me (in a page called "test.php");
Code:
<?php
function imageSlideArray($dir, $path) {
//$dir = '/home/www/mywebsite.com/images/';
//$path = 'Graphics/ShowPics/';
$patterns = '/\.(jpg|jpeg|png)$/'; // only these file types
if($hd = opendir($dir)){
while(false !== ($fname = readdir($hd))){
if(preg_match('/^\.{1,2}$/',$fname)) continue; // exclude current directory, parent directory
if(!preg_match($patterns,$fname)) continue; // exclude file types not in $patterns
$files_array[] = $fname;
}
}
sort($files_array); // sort files a-z
for ($i = 0; $i < count($files_array); $i++) {
$comma = ($i != count($files_array) - 1) ? ',' : ''; // if next item exists in array set $comma as ',' else '' (nothing)
echo "[\"$path$files_array[$i]\"]$comma<br/>";
}
closedir($hd);
}
?>
<?php imageSlideArray('/home/www/mywebsite.com/images/', 'Graphics/ShowPics/');?>
Prints out this;
Code:
["Graphics/ShowPics/about.jpg"],
["Graphics/ShowPics/bookmark.jpg"],
["Graphics/ShowPics/calendar.jpg"],
["Graphics/ShowPics/cross.jpg"],
["Graphics/ShowPics/demo.jpg"],
["Graphics/ShowPics/display.jpg"],
["Graphics/ShowPics/exclamation.jpg"],
["Graphics/ShowPics/extras.jpg"]
-
It's unlikely that any PHP code on an HTML page will execute and the PHP code on that HTML page looks like it wouldn't do anything anyway. However, because not even build_array.php appears to work as advertised, unless that's been changed, it looks like PHP is not available on the server. But it might be something(s) else (permissions, bad coding, etc.) are you certain that PHP is available and turned on for that account? If so, does it have directory reading permission? Why is the index PHP file 'unavailable'? I can see it right there in folder view, that almost must be a permission issue at least for that file.
-
Beverly, we cross posted. Your code works here also. And I agree there is some doubt PHP is available. In your code I would add case insensitivity to the pattern:
Code:
$patterns = '/\.(jpg|jpeg|png)$/i'; // only these file type
and possibly other image types (bmp, gif).
Oh. and you cannot use <br> in javascript like that:
Code:
echo "[\"$path$files_array[$i]\"]$comma<br/>";
Use a line break:
Code:
echo "[\"$path$files_array[$i]\"]$comma\n";
It won't look so pretty on the page, but will look fine in source view, which is what counts in javascript.
-
Will do and thanks for the case insensitivity tip John :)
-
Okay, guys. Now I'm thoroughly confused.
John - PHP is enabled on the server, I use PHP routines on other pages and they work fine. I'm not sure where you found index.php, it's not a file that I use in this application.
Beverley - I haven't tried the code that you listed. I will, and let you know.
Nothing I've read explains why, if I define it as an .html page, the page displays properly, but the slideshow doesn't work. However, if I define it as a .php page, nothing works.
As to the coding, I'm simply copying the code that Beverley sent me. I think Beverley is right in that it has something to do with the addressing. I'm still trying to work on that.
-
1 Attachment(s)
Okay, guys. I finally got a hold of the server tech support. Beverley, you were right. The server path was VERY different. I've modified the code to use the new server paths and it works ... sort of. What happens now is that the webpage displays, but it shows the list of files in ShopPics instead of sending the array to the fadeslideshow script. Here's what the code looks like now, so we're all on the same page, so to speak:
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<?php include('/hsphere/local/home/bswebmas/ohiobuttons.org/test/Script_Files/build_array.php');?>
<script type="text/javascript" src="Script_Files/fadeslideshow.js">
/***********************************************
* Ultimate Fade In Slideshow v2.0- (c) Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for this script and 100s more
***********************************************/
</script>
<script>
var ShowPics=new fadeSlideShow({
wrapperid: "fadeshow1", //ID of blank DIV on page to house Slideshow
dimensions: [400, 300], //width/height of gallery in pixels. Should reflect dimensions of largest image
imagearray: [
</script>
<?php imageSlideArray('/hsphere/local/home/bswebmas/ohiobuttons.org/test/Graphics/ShowPics/', '/test/Graphics/ShowPics/');?>
<script>
],
displaymode: {type:'auto', pause:2000, cycles:1, wraparound:false},
persist: false, //remember last viewed slide and recall within same session?
fadeduration: 500, //transition duration (milliseconds)
descreveal: "none",
togglerid: ""
})
</script>
</head>
<body bgcolor="#FEF4E4">
<center>
<table cellspacing=1 border=0 width=100%>
<tr>
<td colspan=3 valign="top" align="center"><font size="4" color="Navy"><b>The Buckeye State Button Society<br>presents</b></td></tr>
<tr>
<td align="center" valign="middle"><p><font size="6" color="Green" face="Arial"><center>Spring Show 2014</font>
<p><font size=4 color="Navy"><b>April 9-10, 2015</b></font></td>
</tr><tr>
<td align="center">
<table border=0>
<td align="center" valign="top">
<div id="fadeshow1"></div>
</td>
</tr></table>
</tr></table>
</center>
</body>
</html>
Here's what the page display looks like: Attachment 5429
I feel like we're really close to getting this solved. I really want to thank both of you for all your help. Any thoughts on the next step would be greatly appreciated.
-
If you have a look at my previous posts, you'll see that the script tags do not close and then open again around the php function call.
-
Also, in the function that makes the array you have to change <br> to \n (see my previous post)
-
Beverley - I didn't think that they should go there, but if I take out the tags, I just get the html code executed. I don't even get the file list.
John - Thanks for the reminder. With everything else, I just overlooked that.
I've changed the code (taken out the script tags and replace the <br> tag).