multiple album loops

I'm trying to have multiple album-loops on my start page like this:

`

<?php $counterloop1 = 0;<br />
while (next_album()){ ?>



<?php if ($counterloop1==2) {break;}<br />
$counterloop1++; }

?>

<?php $counterloop2 = 0;<br />
while (next_album()){ ?>



<?php if ($counterloop2==2) {break;}<br />
$counterloop2++; }

?>

`

The displayed results in the second loop seem to miss the results from the first loop. Is there a way to reset the query, so that i can start the second loop with the first entry again?

Comments

  • Since the `next_album()` function relies on global context it is impossible to successfully nest multiple loops as each loop will change the global context.

    You will have to implement this using the object model instead. Alternatively you could save and restore the context, but to do that you will have to figure out all of what needs to be saved by understanding the workings of the `next_album()` loop itself.
Sign In or Register to comment.