loop images

hi

i would like to loop the images within a gallery when using next and previous image functions so that after the last comes the first again. is this possible?

thx

Comments

  • Do you mean you want to start again from the first using the next image link after viewing the last image?

    If so, when you are at the last image, then you could use something like
    `

    <?php
    if (hasPrevImage()) {
    $image = $_zp_current_image->getPrevImage();
    } else {
    $i = $_zp_current_album->getNumImages();
    $image = $_zp_current_album->getImage($i-1);
    }
    echo 'getTitle()) . '">« '.gettext('prev').'';
    ?>


    <?php
    if (hasNextImage()) {
    $image = $_zp_current_image->getNextImage();
    } else {
    $image = $_zp_current_album->getImage(0);
    }
    echo 'getTitle()) . '">'.gettext('next').' »';
    ?>

    `
    NOTE: this is not tested code. As always, check function useage with the functions guide.
  • acrylian Administrator, Developer
    More convenient we already have the theme function `getFirstImageURL()` if you use the standard theme setup with image.php looping.
Sign In or Register to comment.