velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Met @ Uber" <...@uberstats.com>
Subject Re: Building Tables with VTL
Date Thu, 14 Aug 2003 19:24:01 GMT
Thanks alot, this is exactly what I was thinking, but unable to put
together.  I'll give it a shot tonight.

~ Matthew

On Thu, 2003-08-14 at 12:44, Simon Christian wrote:
> This is a bit rough'n'ready, but if you convert your array to a 
> Collection (myList):
> 
> #set( $rowLength = 3 )
> #foreach( $item in $myList )
> #if( $velocityCount == 1 )
> <tr>
> #elseif( $velocityCount % $rowLength == 1 )
> </tr>
> <tr>
> #end
>    <td>$item</td>
> #if( $velocityCount == $myList.size() )
> </tr>
> #else
> #end
> #end
> 
> You could also prettify it a bit by fleshing out the final cells on the 
> last row. Also make it more efficient by pre-assigning the list size to 
> a variable.
> 
> - simon
> 
> 
> 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
> 
> 
> ---------------------------------------------------------------------
> 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


Mime
View raw message