Random thumbnail display - directory issues

I'm trying to display a selection of random thumbnails taken from my Zenphoto galleries at the bottom of each page in an existing website (I've replaced an old jAlbum installation with Zenphoto and am trying to reproduce the old site layout.)

Site structure:

root
....\main
....\aaaa
....\bbbb
....\zenphoto
testrandomimages.php

I can get the thumbnails to display fine when calling them from the top-level directory (i.e. the site root) using the page testrandomimages.php as shown above

I do this by using the connection code:

`
<?php
define('ZENFOLDER', 'zp-core');
define('WEBPATH', 'zenphoto');
require_once(WEBPATH . "/" . ZENFOLDER . "/template-functions.php");
?>
`
at the top of the page.

However when I move the file into a sub-directory (e.g. under the \main directory, viz.:

....\main\testrandomimages.php)

I amend the connection code to:

`
<?php
define('ZENFOLDER', 'zp-core');
define('WEBPATH', 'zenphoto');
define('ROOT', ($_SERVER['DOCUMENT_ROOT']));
require_once(ROOT . "/" . WEBPATH . "/" . ZENFOLDER . "/template-functions.php");
?>
`
to allow me to access template-functions.php

This appears to work but no images are being displayed.

The output browser source code is identical in both situations:

`













`
The problem thus appears to be with the directories from which the images are being called relative to the calling page's location.

I've tried combinations of inserting _root_ directory into URLs at various points in the code but to no avail.

Any guidance would be much appreciated.

Mike

Comments

  • The HREF paths you show above are "relative" so they will descend from the "page" which calls them. Since you moved that page into a subfolder, that will be the root of the HREF.

    Try defining WEBPATH as '/zenphoto'
  • Perfect! That did it.

    Many thanks.

    Mike
Sign In or Register to comment.