Christian Beutenmueller said:
> I'd like to use a macro on the right side in a #set statement. But I
> cannot get it working. Any ideas or help is appreciated (Yes, I am a
> newbie in vtl and velocity).
> I've tried :
>
> The obvious (wrong):
> #set( $foo = #mymacro( "arg1" ) )
>
>
> The next idea (also wrong)
> #set ( $quot =  '"' )
> #set ( $foo = "#mymacro( ${quot}arg1${quot})" )
> $foo
>
> Can someone point me in the right direction? Thanks in advance!

you almost had it.  remember, by default velocity does not parse things in
single quotes, but does parse those in double quotes.  so as long as your arg1
does not require parsing, you can do:

#set( $foo = "#mymacro( 'arg1' )" )

and the string 'arg1' will be passed to the macro which is then evaluated and
set as $foo.

if you do need arg1 to be parsed, you will either have to use the
(View)RenderTool or else do it in two steps:

#set( $arg1 = "arg1" )
#set( $foo = "mymacro( $arg1 )" )

Nathan Bubna
[EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to