There is a new VTL operator called the 'Range' operator (couldn't think of a better name...) that produces an integer range. This is a simple parallel to the 'Object Array' operator ( ["a","b"]). There has been some interest both within the vel project as well as outside of it (Turbine user(s)), so it's in there provisionally. If someone has a big problem with this being there, shout and we can discuss and/or remove. Since it doesn't add any directives and is a simple parallel to the ever-useful object array, there shouldn't be much resistance. The motivation was that there is a need for designers to have the ability to loop for a designer-chosen number of iterations. For example, if you are laying out tables, and want to make sure that each is the same size, and need to 'fill' one because the data provided in the context is not enough, you can use this. Since this could be done easily with the current VTL #foreach(), and we not have to introduce that darkly dangerous highway-to-Hades 'for()' or 'while()' syntactical construct, this way was implemented. ;-> The upshot is that it will produce an object array containing Integers from n to m inclusive : [n..m] where n := reference | integer m := reference | integer Only constraint on n & m is that they produce integers. The sign is not important, and n > m is allowed. It will simply count down. Use examples : #foreach($i in [1..5]) $i #end will produce 1 2 3 4 5 #foreach($i in [2..-2]) $i #end 2 1 0 -1 -2 #set($arr = [0..1] #foreach($i in $arr ) $i #end produces 0 1 So it's rather obvious. Look at test/templates/range.vm for examples. Discussion, as always.... geir -- Geir Magnusson Jr. [EMAIL PROTECTED] Velocity : it's not just a good idea. It should be the law. http://jakarta.apache.org/velocity
