I am trying out an while loop to show only a given 'from' 'to' number of pics at the top of album .
e.g showing number 4,5,6 from 10 images.
I got it working but I found out that if I break the loop at the 'to'position the next (normal imagethumbs) loop on the album page starts at where I broke the first loop.
to fixthis I have to end the custom loop with another full but empty while loop;
so this works and shows pics 4,5,6
`?php
static $check = '1';
static $ctr1 = '4';
static $ctr2 = '6';
while (next_image(true)):
if ($check >= $ctr1) {
printCustomSizedImage(getImageTitle(), null, 45);
$check++;
}else {$check++; }
if ($check > $ctr2) {break;}
endwhile;
// the empty while loop to not break the next while loop
while (next_image(true)):
endwhile; ?>`
any ideas on how to normally start a fresh loop when having exited an previous loop prematurely?
Well, that's probably the best way to do it, as it restores the context as normal.
You could also call it manually, with this:
`if ($_zp_images != NULL) {
$_zp_images = NULL;
$_zp_current_image = $_zp_current_image_restore;
restore_context();
}`
Right after the stopped loop.
FYI, while(next_image(true)); is a complete statement No need for the colon/endwhile;