Gary Lawrence Murphy wrote:
> If, on the other hand, you decide to use Turbine with the Velocity
> template service and the Torque OM service, and you provide your own
> $data service that provides a method to effect the query and return
> a list of results, the page you describe is simply
>
> #foreach $item in $data.getList
> <tr><td>$item.col1</td><td>$item.col2</td></tr>
> #end
>
> which is pretty darn simple.
>
> (those who know velocity macros better than I could probably craft a
> better example)
The only thing I would suggest is using parenthesis :)
#foreach( $item in $data.getList)
...
#end
And yes, you can wrap this in a VM :
#macro( mytable $list )
<table>
#foreach( $i in $list )
<tr><td>$i.col1</td><td>$i.col2</td></tr>
#end
</table>
#end
and use
#mytable( $data.getList )
but really, that doesn't buy you much until you want to start doing nice
formatting, which VMs really help with.
geir
--
Geir Magnusson Jr. [EMAIL PROTECTED]
System and Software Consulting
Developing for the web? See http://jakarta.apache.org/velocity/
You have a genius for suggesting things I've come a cropper with!
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]