On Nov 15, 2003, at 8:06 AM, Nishikant Kapoor wrote:
> Hello list,
>
> How can I display the retrieved results at predefined spots in the
> output template, using a tmpl_loop?
> Here is the exact problem:
>
> I retrieve 8 members from db, create a tmpl_loop and display them in
> the template in 4 rows. But, I want these members to be at certain
> spots:
>
> Member-2 Member-5
> Member-7 Member-1
> Member-3 Member-6
> Member-4 Member-8
>
>
two ways come to mind --
1. judicious use of tmpl_if and ::expr
OR
2. the tmpl_loop is nothing but a ref to an array of hashes. Array
elements can be arrranged any way you want, and the arrangment will
persist (unlike a hash, which has its own mind about these things).
Just arrange your results from the db in the way you want before
stuffing them in the array... when you unfold the array you will get
what you want.
|