Log in

View Full Version : Slideshow No Longer Works



Jim Weinberg
05-09-2018, 02:47 PM
First, let me start by saying that I'm not a PHP programmer. Several years ago one of the forum members wrote some PHP code for me and it worked fine.

Recently, the company that provided our hosting service was bought out and now the code no longer works.

The purpose of the code is to display sets of photos located in different folders. The display is actually handled by 3 different PHP routines. I've attached them in a zip file to save space in this post.

The first, ShowScenes1, merely sets up the display area. Essentially just a bordered table.

The second, showscenedefs, actually does the displaying of the photos. It uses the third, newbuild_array, to create the arrays of photo file names in alphabetical order.

I think the problem is that now, the newbuild_array can't find the photo folders.

I believe that the problem is the way showscenedefs is passing the addresses of the photo folders. It appears to be absolute and, I think, tailored to our previous hosting service.

I've tried a couple of different ways to address for folders, pretty hit and miss, but no luck.

I'm hoping that someone can come up with a way to make the addressing more generic and server independent.

Thanks in advance for any help you can provide.

Jim

DyDr
05-09-2018, 06:08 PM
$_SERVER['DOCUMENT_ROOT'] should exist and be set to the correct path for your document root folder. You can create a simple .php script to echo that value to see if it is. If it isn't set or isn't correct, you can set it yourself in the code to the correct value.

The php statements that call imageSlideArray() can then use $_SERVER['DOCUMENT_ROOT'] in place of the hard-coded path.

Jim Weinberg
05-11-2018, 01:41 PM
Hello DyDr.

Thank you so much for your help. I put a routine together to echo the results of the $_SERVER['DOCUMENT_ROOT'] and replaced the current addressing and it worked fine.

So I didn't have to fool with it again, I changed the address line to <?php imageSlideArray($_SERVER['DOCUMENT_ROOT'] . '/Graphics/ShowPics/Spring_2018/' ..... and it worked first time out of the box.

I still don't quite understand why it needed the absolute address as all the routines were on the same server and website file set.

Again, many thanks.
Jim