velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Barbara Baughman <baugh...@utdallas.edu>
Subject RE: Building Tables with VTL
Date Thu, 14 Aug 2003 15:20:01 GMT
Velocity doesn't recognize array notation like this.  You would need
to do:
#foreach ($item in $items)
   <td>$item</td>
#end

if $items is an array, this will take care of it without the need for
array notation.

If you need a counter, Velocity has the system variable
$velocityCount that starts at 1.

Barbara Baughman
X2157

On Thu, 14 Aug 2003, Met @ Uber wrote:

> Thanks, but perhaps I didn't explain myself to well.  If I had an array
> where I can access it through indexes I would print my table as such.
>
> <tr>
>   <td> $item[0] </td>
>   <td> $item[1] </td>
>   <td> $item[2] </td>
> </tr>
> <tr>
>   <td> $item[3] </td>
>   <td> $item[4] </td>
>   <td> $item[5] </td>
> </tr>
>
> It needs to be dynamically generated across and down.  So I need some
> sort of #foreach with a counter I'm guessing.
>
> Any suggestions?
>
> On Thu, 2003-08-14 at 09:49, Mark Lybarger wrote:
> > <table>
> > #foreach( $item in $myList)
> > 	<tr>
> > 		<td></td>
> > 		<td></td>
> > 		<td></td>
> > 	</tr>
> > #end
> > </table>
> >
> > -----Original Message-----
> > From: Matthew Metnetsky [mailto:matt@uberstats.com]
> > Sent: Thursday, August 14, 2003 8:59 AM
> > To: Velocity User
> > Subject: Building Tables with VTL
> >
> >
> > I'm trying to build a table (3 columns by X rows) which would be
> > extremely easy if I could use for/while loops, but I can't.
> >
> > As I'm sure this has been done, I was wondering if anyone could give me
> > a shove in the right direction.
> >
> > -------------
> > |   |   |   |
> > -------------
> > |   |   |   |
> > -------------
> >
> > Thanks in advance,
> >
> > ~ Matthew
> >
> > ---
> > Incoming mail is certified Virus Free.
> > Checked by AVG anti-virus system (http://www.grisoft.com).
> > Version: 6.0.509 / Virus Database: 306 - Release Date: 8/12/2003
> >
> >
> > ---
> > Outgoing mail is certified Virus Free.
> > Checked by AVG anti-virus system (http://www.grisoft.com).
> > Version: 6.0.509 / Virus Database: 306 - Release Date: 8/12/2003
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: velocity-user-help@jakarta.apache.org
> --
> Met @ Uber <met@uberstats.com>
> Uberstats
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-user-help@jakarta.apache.org
>
>

Mime
View raw message