Multiple items in a single loop (different items in a single TR)
-
I’m looking to create a table with three columns, where an image is shown in each table cell, three across, and unlimited down. So each row would show three images. Is there a simple way to grab different items in the loop in the same row? If I was doing one image per row, I would just put the <table> tags outside the loop, and have something like:
<tr><td>[field image]</td></tr>
inside the loop. However, now I need:
<tr><td>[field image]</td><td>[field image]</td><td>[field image]</td></tr>
where the three images are each grabbed from different cycles of the loop.
I could put a second loop inside the loop like:
<tr> [-loop count=3] <td>[field image]</td> [/-loop] </tr>
but I would need to pass the location in the loop from the outside loop to the inside loop, which is kind of a pain. Is there a simpler way to do this? If not, what’s the best way to pass the loop position between the outside and inside loop?
Thanks.
- The topic ‘Multiple items in a single loop (different items in a single TR)’ is closed to new replies.