You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Ed Yu <ek...@asgnet.psc.sc.edu> on 2002/07/14 16:38:10 UTC

Question about #foreach

I've got a question about the #foreach directive. When reading the docs,
it mentioned about the index variable velocityCount within the
directive. My question is what is the name of the variable if there is a
nested #foreach construct:

#foreach ($objList in $objLists)
	#foreach ($obj in $objList)
	#end
#end

How do I access the outer loop variable other than setting it explicitly
like:

#foreach ($objList in $objLists)
	#set ($outerIndex = $velocityCount)
	#foreach ($obj in $objList)
	#end
#end


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Question about #foreach

Posted by "Geir Magnusson Jr." <ge...@adeptra.com>.
On 7/14/02 10:38 AM, "Ed Yu" <ek...@asgnet.psc.sc.edu> wrote:

> I've got a question about the #foreach directive. When reading the docs,
> it mentioned about the index variable velocityCount within the
> directive. My question is what is the name of the variable if there is a
> nested #foreach construct:
> 
> #foreach ($objList in $objLists)
> #foreach ($obj in $objList)
> #end
> #end
> 
> How do I access the outer loop variable other than setting it explicitly
> like:
> 
> #foreach ($objList in $objLists)
> #set ($outerIndex = $velocityCount)
> #foreach ($obj in $objList)
> #end
> #end
> 

Set it explicitly :)

-- 
Geir Magnusson Jr. 
Research & Development, Adeptra Inc.
geirm@adeptra.com
+1-203-247-1713



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>