You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by mi...@bodaro.com on 2001/02/12 20:17:06 UTC

More control in foreach

One of the things I want to do is pageination – every site I've built 
needs this. One way to implement is to cache a big array server side and 
just display relavent parts from it. It would be nice if the #foreach 
macro was more like a regular for, where you can define the start and end 
index.

And really nice would be a #Break to get out of the #foreach.

I suspect that we can create our own macros? To do such things?

Mike Papper

Re: More control in foreach

Posted by Jon Stevens <jo...@latchkey.com>.
on 2/12/01 11:17 AM, "mike@bodaro.com" <mi...@bodaro.com> wrote:

> One of the things I want to do is pageination – every site I've built
> needs this. One way to implement is to cache a big array server side and
> just display relavent parts from it. It would be nice if the #foreach
> macro was more like a regular for, where you can define the start and end
> index.

You can by properly defining the array that you are looping over.

> And really nice would be a #Break to get out of the #foreach.

why? you either want to display the data or you don't. a #if can achieve
that.

> I suspect that we can create our own macros? To do such things?

Yes.

-jon

-- 
If you come from a Perl or PHP background, JSP is a way to take
your pain to new levels. --Anonymous
<http://jakarta.apache.org/velocity/> && <http://java.apache.org/turbine/>