Member
Member
michaelcmod   2009-07-16, 22:26
#1
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
Member
Member
sbillard   2009-07-16, 23:12
#2
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.
Administrator
Administrator
acrylian   2009-07-17, 07:53
#3
More convenient we already have the theme function `getFirstImageURL()` if you use the standard theme setup with image.php looping.
  
Powered By MyBB, © 2002-2026 MyBB Group.
Made with by Curves UI.