adding gallery link to homepage

I am building a site for a friend who is a model, they want a open access part to the site with the usual features, bio, blog, links etc and then a secure side with all of there photography on.

I have done this before, using ZP in the secure section to handle the gallery needs, but this time this person wants the most recent say 3-5 galleries to appear on the home page of the open side of the site, is there a way to do this easily or is it a lot of php coding involved?

I was hoping there'd be an easy way that when they update the galleries with new content it could automatically keep the open home page updated if you understand what i mean.


  • acrylian Administrator, Developer
    3-5 galleries
    Gallery = ZEnphoto site, you mean albums. Just to avoid misunderstandings.

    If that home page is outside Zenphoto you have to do some coding following this way:
    As noted it might not work if the other part of the site is also run by a CMS (Wordpress an possibly others as well). For Wordpress there are some 3rd party tool available.

    But Zenphoto could manage the full site requirements actually using the Zenpage CMS plugin, btw.
  • thanks alot for the reply, I have tried to make it work with limited success.
    The site I'm building isnt wordpress, just a standard html site, but the gallery side of the site is ZP yes, its just the way its worked out best for me.
    my site is built in the root directory /public_html/ and the ZP install is in /public_html/members/ if I put the following in

    <?php define('SERVERPATH',str_replace('\\','/',dirname(__FILE__)).'/members'); define('WEBPATH','/'.basename(dirname(__FILE__)).'/members'); require_once(SERVERPATH.'/zp-core/template-functions.php'); ?>

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" """>


    <p> This example will show a pre-defined image. Really, almost any theme related actions could be done here. </p>

    <?php $albumName = 'albums/mandy1'; $imageName = 'mandy1.jpg'; $image = newImage(NULL, array('folder'=>$albumName,'filename'=>$imageName)); makeImageCurrent($image); printCustomSizedImage(getImageTitle(), 500); ?> <!-- provide a link to the Zenphoto gallery --> <p>

    ">Visit the actual gallery from which this image was extracted.
    </p> </body> </html>

    this is in a file called tester.php saved in the root folder, it does nothing, it doesn't show the theme, and the gallery link takes me to www.mywebaddress/public_html/members not www.mywebaddress/members/albums/mandy1

    if i move the same file into the members folder and alter the first line to

    <?php define('SERVERPATH',str_replace('\\','/',dirname(__FILE__)).'/'); define('WEBPATH','/'.basename(dirname(__FILE__)).'/'); require_once(SERVERPATH.'/zp-core/template-functions.php'); ?>

    the link works but still no theme and no picture, plus this doesn't help as its a level to high??

    Any help appreciated
  • Moderator's note: This posting got trapped by our spam filter. Probably because the html above was not encased in the code defining peck-marks. It is fortunate that I did see the posting. We get over 90 spam postings an hour, so it is quite easy for a legitimate posting to be missed.

    So the caution is:

    1. Escape all "code" type text.
    2. Do not post something that looks like an URL unless needed--specially "dummy" ones as URLs are one thing that the spam filter is quite strict about.

    BTW, if the filter does "catch" you you are automatically marked as "blocked" and will not be able to post until a moderator discovers and un-blocks you.
  • Thanks for that I emailed also as I didn't know what else to do.

    so anyone with any advice appreciated. will admit php isn't my strong point.
  • Since your script is in the ROOT of your WEB site the define for `WEBPATH` needs to be `define('WEBPATH','/members');`
  • thats got the link working aiming towards the gallery, but its still leaving the serverpath not doing its job, still no theme and no picture :(
  • have tried using location and absolte url, and a few other things, but I'm pretty sure its the server path thats letting me down just don't know how to aim it in the right place, annoying thing is I know it will be something simple :/
  • The server path should be correct. Do you get an error on the `require_once` statement? Anyway your path will be someting like `/public_html/members/`, but maybe there is some other stuff pre-pended.
  • this is what I have


    like I said, not getting any errors, but it won't find the picture or the theme?
  • acrylian Administrator, Developer
    If that page is really a html page (.html) you might need to configure your server to accept php code within that. By default most servers requires .php to execute php code.
  • server is set up for php, zenphoto is installed and fully working on the site in the members folder, and the file I'm on is"tester.php" so have the basics covered, but still can't get it to work, can't be that dificult surely but I can't see where I'm going wrong.
  • I see someones taken an interest as the example caode has been altered at some point yesterday, the
    has been replaced with

    thing is that still doesn't work.

    what next.
  • You will have to do some debugging. First of all set your php to display errors on the web pages so that you know all the errors you may be gettins.

    Then put some debugging statements into your script. For instance echo out the SERVER PATH and WEB PATH to be sure they are correct.

    Try calling some simple functions, for instance `exposeZenPhotoInformations()` and see what you get.
  • Finally got the picture to work :) thanks for the advice.

    now for my next question, is there a way of displaying the latest say 3 galleries in boxes rather than just a single image as in the tutorial? this way I wouldn't need to manually update the homepage it would be automated whenever I uplaod new galleries so new visitors can see there is new content?
  • acrylian Administrator, Developer
    You mean of course "albums" (

    A thumb for each album? Try including the image_album_statistics plugin additionally. Or use the object model directly:
Sign In or Register to comment.