View Full Version : Swiss Army Knife not displaying

02-23-2009, 10:00 AM
1) Script Title: Swiss Army Knife with php array

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

3) Describe problem:

I have had this script working for some while now, but on miving to a different domain with same host, I cannot get the slides to work.
php script to pull out the array is:
function returnimages($dirname="./../pics/") {
$files = array();
if($handle = opendir($dirname)) {
while(false !== ($file = readdir($handle))){
if(eregi($pattern, $file)){
echo 'slides[' . $curimage .']=["' . $dirname . $file . '", "", ""];' . "\n";


echo "var slides=new Array();" . "\n";

Both the scripts are pulled from off-page includes.

On the page there is no image but message "Slide Show Image"

I have tried every which way with this and get nothing yet on my original website with the same code it is working fine.

Any clue?



02-23-2009, 11:33 AM
Hi Folks

Have it sorted. The script needs to sit in the root otherwise the javascript doesn't recognise the array.

How odd. But at least know why it wasn't working.



02-23-2009, 04:06 PM
Well, this (highlighted):

unction returnimages($dirname="./../pics/") {

is your path to the images. It must be valid for both the PHP code (wherever it is run from) and for the page that uses the images. That path looks to me to mean (breaking it down):

./ - this folder

./../ - this folder's parent folder

./../pics/ - this folder's parent folder's child folder named pics