You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Ken Anderson <ka...@pacific.net> on 2002/03/07 06:31:35 UTC

template layout using foreach

  For a product list displayed in rows, I'd do something like this:

<table>
#foreach ($row in $rowset)
<tr><td>$row.id</td><td>$row.name</td><td>$row.desc</td><td>$row.price</td></tr>
#end
</table>

What is the best way to handle a more free form display in the template?
I've found that using $rowset.get(1).name works.
Is this the proper syntax? Is there a better way?

Thanks,
Ken Anderson




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: template layout using foreach

Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
On 3/7/02 12:31 AM, "Ken Anderson" <ka...@pacific.net> wrote:

> For a product list displayed in rows, I'd do something like this:
> 
> <table>
> #foreach ($row in $rowset)
> <tr><td>$row.id</td><td>$row.name</td><td>$row.desc</td><td>$row.price</td></t
> r>
> #end
> </table>
> 
> What is the best way to handle a more free form display in the template?
> I've found that using $rowset.get(1).name works.
> Is this the proper syntax? Is there a better way?
>

Do you mean how to access things w/o the #foreach()?

Depending on what $rowset is, seems fine by me...

-- 
Geir Magnusson Jr.                                     geirm@optonline.net
System and Software Consulting
Java : the speed of Smalltalk with the simple elegance of C++... 


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>