> Hi,
> Say I've for got the following parameter passed to my template:
> names_loop => $names,
>
> Where $names looks like:
> $names =
> [
> {name => name1},
> {name => name2},
> {name => name3},
> # ... 50 such names
> ];
>
> What do I write in my template to print 3 names per line, for
example?
> Is this even possible or do I have to re-arrange my data?
> I tried:
> <tmpl_loop names_loop><tmpl_var name> <tmpl_var name> <tmpl_var
name>
> </tmpl_loop>
>
> But that just printed each name 3 times :-(
>
> Thanks in advance,
> --
> Offer Kaye
>
Offer,
To get 3 items per line, yes, you'd have to manipulate the data before
feeding it to the template. Into something like,
$names =
[
{name1 => name1, name2 => name2, name3 => name3},
{name4 => name4, name5 => name5, name6 => name6},
];
However, you can print 2 items per line by switching
on 'loop_context_vars' and doing something like,
<TMPL_LOOP names_loop>
<TMPL_VAR name> <TMPL_UNLESS __odd__><BR></TMPL_UNLESS>
</TMPL_LOOP>
or to create a table with 2 columns
<table>
<TMPL_LOOP names_loop>
<TMPL_IF __odd__><tr></TMPL_IF>
<td><TMPL_VAR name></td>
<TMPL_UNLESS __odd__></tr>TMPL_UNLESS>
</TMPL_LOOP>
</table>
Carl Franks
-------------------------------------------------------
This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170
Project Admins to receive an Apple iPod Mini FREE for your judgement on
who ports your project to Linux PPC the best. Sponsored by IBM.
Deadline: Sept. 24. Go here: http://sf.net/ppc_contest.php
_______________________________________________
Html-template-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/html-template-users