You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Frans Thamura <ja...@intercitra.com> on 2003/01/30 05:54:16 UTC
2 time looping for single context with continoue statement
Hi All,
I need a tips,
How to make a foreach for 10 value but using 2 times foreach.
so there is a break in middle of them,
so i can foreach from 1-5 and do again in another foreach.
Thnks
Frans Thamura
Intercitra Innovation Center
www.intercitra.com
---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org
Re: 2 time looping for single context with continoue statement
Posted by Simon Christian <si...@cpd.co.uk>.
Hi Frans,
A simple, if rather crude, way of doing this would just be to test using
the inbuilt $velocityCount variable, which is automatically incremented
on each loop. A simple example:
-------------------------------------
## show the first 5 entries
1 to 5:
#foreach( $kk in [1..10] )
#if( $velocityCount <= 5 )$kk
#end
#end
## now show the second 5 entries
6 to 10:
#foreach( $kk in [1..10] )
#if( $velocityCount > 5 )$kk
#end
#end
-------------------------------------
Which will generate the output:
-------------------------------------
1 to 5:
1
2
3
4
5
6 to 10:
6
7
8
9
10
-------------------------------------
- simon
Frans Thamura wrote:
> Hi All,
>
> I need a tips,
>
> How to make a foreach for 10 value but using 2 times foreach.
>
> so there is a break in middle of them,
>
> so i can foreach from 1-5 and do again in another foreach.
>
> Thnks
>
>
> Frans Thamura
> Intercitra Innovation Center
> www.intercitra.com
>
>
>
> ---------------------------------------------------------------------
> 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