You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by ro...@yahoo.com on 2002/05/16 09:46:29 UTC
return from macros
hi,
is there the possebility
to have a return from macros?
actually there is but is there a more
programmerlike way. at the moment
i am doing this.
>>> def
#macro( Foo $Input $Result)
#set ($Result = "BAR")
#end
>>>call
# set ($result = "")
#Foo("Someinput" $result)
ciao robertj
------------------------------------------------------------
Robert Kuzelj
Gaissacherstrasse 7 email: robert_kuzelj@yahoo.com
81371 Muenchen tel: 0177/5302230
the trinity of desirables of (software) architecture:
Firmitas, Utilitas, Venustas (marcus vitruvius 20 BC)
strength, utility, beauty
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: return from macros
Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
On 5/16/02 3:46 AM, "robert_kuzelj@yahoo.com" <ro...@yahoo.com>
wrote:
> hi,
>
> is there the possebility
> to have a return from macros?
>
> actually there is but is there a more
> programmerlike way. at the moment
> i am doing this.
>
>>>> def
> #macro( Foo $Input $Result)
> #set ($Result = "BAR")
> #end
>
>>>> call
> # set ($result = "")
> #Foo("Someinput" $result)
>
The point of VMs was not to be a programmatic subroutine that can return
values, but really a way of putting a name on, and parameterizing a bit of
VTL.
That said, there is one trick you can use :
#macro(Foo $input)
<image src="$input">
#end
Then
#set($imgmarkup = "#Foo('cloud.jpg')")
Which will set $imgmarkup to '<image src="cloud.jpg">'
This works because "" will 'render' it's contents.
I'll be the first to admit this is far from a real return, but you can use
it effectively in certain situations.
geir
--
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>