You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Robert Brandner <ro...@chello.at> on 2004/08/13 19:49:19 UTC

macro names from variables?

Hello!

Is it possible do get the name of a macro to call from a variable?

something like:

#set($macroname = 'foo')

#$macroname($parameters)   ## <-- something like that, to call the macro

#macro(foo $parameters)
     ##
     ## something wonderful is to happen here.
     ##
#end

I tries with double quotes but had no success.

Any ideas? Is it possible at all?

Best regards
Robert


---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Re: macro names from variables?

Posted by Geir Magnusson Jr <ge...@4quarters.com>.
On Aug 13, 2004, at 1:49 PM, Robert Brandner wrote:

> Hello!
>
> Is it possible do get the name of a macro to call from a variable?
>
> something like:
>
> #set($macroname = 'foo')
>
> #$macroname($parameters)   ## <-- something like that, to call the 
> macro
>
> #macro(foo $parameters)
>     ##
>     ## something wonderful is to happen here.
>     ##
> #end
>
> I tries with double quotes but had no success.
>
> Any ideas? Is it possible at all?

The only way is with an evaluation tool, that takes a string arg and 
treats it like a template.

There should be something in velocity tools.

geir

>
> Best regards
> Robert
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-user-help@jakarta.apache.org
>
>
-- 
Geir Magnusson Jr                                   203-247-1713(m)
geir@4quarters.com


-- 
Geir Magnusson Jr                                   203-247-1713(m)
geir@4quarters.com 
                                  


---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org