Hi guys
I have a script that lists through the images links to which are stored in DB, but when the script gets to the final image it does not go back to the first image.
Here’s the actual part that goes through images
[code=php]
/* prepare large images */
if ($num_results > 1) {
$onClick = “”;
for ($k=0; $k<$num_results; $k++) {
$onClickCounter = $k + 1;
/* onclick each row to be hidden execpt current row. Clicking on the current large pic should show the next. When at the end, go back to beginning */
if ($counter == ($onClickCounter -1)) {
// show the next pic
$onClick .= “document.getElementById(‘img-700-$onClickCounter’).style.visibility=’visible’;”;
} else {
// hide all other pics
$onClick .= “document.getElementById(‘img-700-$onClickCounter’).style.visibility=’hidden’;”;
}
/* BUG – to finish – doesn`t show first record again at end
// if last record, set first to visible
if ($onClickCounter == $num_results) {
$onClick .= “document.getElementById(‘img-700-1′).style.visibility=’visible’;”;
$k=0;
}
*/
}
$strLargeImages .= “ntt<div id=”img-700-“.$counter.””>nttt<p class=”img-caption”>$caption</p><p class=”img-caption”>$largeCaption</p><a href=”javascript:popUpImageGallery(‘$productID’)”><img src=””.$path.”700/”.$filename.”” alt=””.$altText.”” title=””.$altText.”” onclick=”$onClick” /></a>ntt</div>”;
} else {
$strLargeImages .= “ntt<div id=”img-700-“.$counter.””>nttt<p class=”img-caption”>$caption</p><p class=”img-caption”>$largeCaption</p><a href=”javascript:popUpImageGallery(‘$productID’)”><img src=””.$path.”700/”.$filename.”” alt=””.$altText.”” title=””.$altText.”” /></a>ntt</div>”;
}