velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Damian Gajda <dga...@ngo.pl>
Subject Re: mod function?
Date Wed, 11 Sep 2002 07:04:41 GMT
> Hi.
> When I looping through with a #foreach
> I would like to print out some content every 3rd iteration.
> 
> While I can do this using variables, etc, I was wondering if there is a velocity elegant
way to do this.
> Thanks.

It's easy and already available:
#foreach($item in $items)
#set($var = $velocityCount % 3)
$var
#end

BTW. It is always good to read the users guide on velocity site or docs
provided with the distribution. It will certainly save You some time.

Take care,
-- 
Damian Gajda
Web Application Design and Consultancy
dgajda@ngo.pl
mobile +48 501 032 506




--
To unsubscribe, e-mail:   <mailto:velocity-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:velocity-user-help@jakarta.apache.org>


Mime
View raw message