You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by e v a n l e o n a r d <ev...@mindreef.com> on 2005/03/02 19:23:31 UTC
"For each" on an object?
Hello,
I am trying to create a macro that can either take a single string
parameter, or an array of strings.
The code looks something like this:
#macro(get $things)
#foreach($thing in $things)
## do something...
#end
#end
What I would like to happen is that if $things is only a single object and
not a collection, for it to be assigned to $thing, and then the inner code
run only once. This way foreach loops would be useful over more variable
input.
Has there been any thought about this already? Or, how would others solve
this problem?
Sincerely,
Evan Leonard
---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org