You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Don Laursen <do...@darkphoton.com> on 2001/02/02 17:53:07 UTC

RE: Nesting in Velocity

>
> Velocity questions go to the Velocity list. In case you
> missed it, this is
> the Turbine list.
>
Oops, I asked for that one, :o
My question was spawned by using a single "=" instead of "==" to test for
equivelance of two variables. I was referencing the latest documentation,
but didn't have this simple operator. So leave it to me to get caught up on
the simple things...Doh!


Can this be added to the Velocity docs?


I suggest to append to the "Logical Operators" section:


Testing equivelance of Velocity variables:

         #set ($foo = "some value")
         #set ($bar = "some other value")

	   #if ($foo == $bar)
            do something here if they equate
         #else
            do something here is they are not the same
         #end



Nesting Loops:
(not sure how deep you can go)


   #foreach ($bigitem in $biglist)
       do something here...

           #foreach ($smallitem in $smalllist)
                do something here...

                    #foreach ($tinyitem in $tinylist)
                       do something here...

                    #end
           #end
    #end











Re: Nesting in Velocity

Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
Don Laursen wrote:

> Can this be added to the Velocity docs?
> 
> I suggest to append to the "Logical Operators" section:
> 
> Testing equivelance of Velocity variables:
> 
>          #set ($foo = "some value")
>          #set ($bar = "some other value")
> 
>            #if ($foo == $bar)
>             do something here if they equate
>          #else
>             do something here is they are not the same
>          #end

I went and checked.  Yes, I think you are right :)  I am sure John
Castura, Minister of Information, will get this in there.
 
> Nesting Loops:
> (not sure how deep you can go)

What do you mean 'how deep'?  I can't imagine that there is a limit
until you run out of RAM or something...
Give it a whirl and let us know :)

geir

-- 
Geir Magnusson Jr.                               geirm@optonline.com
Velocity : it's not just a good idea. It should be the law.
http://jakarta.apache.org/velocity

RE: Nesting in Velocity

Posted by John Castura <jc...@kw.igs.net>.
Thanks Don! I'm checking that in now...

> My question was spawned by using a single "=" instead of "==" to test for
> equivelance of two variables. I was referencing the latest documentation,
> but didn't have this simple operator. So leave it to me to get caught up on
> the simple things...Doh!
> 
> 
> Can this be added to the Velocity docs?
> 
> 
> I suggest to append to the "Logical Operators" section:
> 
> 
> Testing equivelance of Velocity variables:
> 
>          #set ($foo = "some value")
>          #set ($bar = "some other value")
> 
> 	   #if ($foo == $bar)
>             do something here if they equate
>          #else
>             do something here is they are not the same
>          #end