![]() |
|
partial while loop question - Printable Version +- ZenphotoCMS Forum (https://forum.zenphoto.org) +-- Forum: Support (https://forum.zenphoto.org/forum-1.html) +--- Forum: General support (https://forum.zenphoto.org/forum-4.html) +--- Thread: partial while loop question (/thread-2120.html) |
partial while loop question - BertSimons - 2008-01-23 I am trying out an while loop to show only a given 'from' 'to' number of pics at the top of album . 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. 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? partial while loop question - trisweb - 2008-01-23 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, |