velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Peter Romianowski" <megap...@gmx.de>
Subject RE: Velocimacros calling velocimacros?
Date Mon, 12 Aug 2002 20:07:36 GMT
Hi Derek,

you have to define the mochaLink-macro prior the sectionIndex-macro.
As I recall Velocity does not support forward-declarations of macros

Peter

-----Original Message-----
From: Derek Stevenson [mailto:derek@retrocode.com] 
Sent: Monday, August 12, 2002 9:28 PM
To: velocity-user@jakarta.apache.org
Subject: Velocimacros calling velocimacros?


Hi,

I have the following defined in my GlobalMacros.vm:

#macro (sectionIndex)
	#foreach ( $sectionlink in $sgslocation.SectionIndex )
	  link:
	  #mochalink ( $sectionlink $sectionlink.Title )
	  <BR/>
	#end
#end

#macro (mochaLink $mochalink $linktitle)
	<A
HREF="$link.setPage("$mochalink.VelocityURI").addPathInfo("action", 
"UpdateLocation").addQueryData("sectionpath", 
"$mochalink.SectionPath").addQueryData("pageid", 
"$mochalink.PageID")">$linktitle</A>
#end

However, when I call

#sectionIndex

from a screen I get the following output in my browser:

link: #mochalink ( Section [title='Intervention' index='1' 
path='bingeeating.bequiz-feedback.be-conseq1.intervention'] Intervention
)
link: #mochalink ( Section [title='No Intervention' index='2' 
path='bingeeating.bequiz-feedback.be-conseq1.nointervention'] No 
Intervention )

It looks like Velocity is calling #sectionIndex fine but won't call 
#mochaLink in turn, rather it simply expands #sectionlink and 
#sectionlink.Title.  Is this expected behavior?  Is there a flag
somewhere 
that allows me to call macros from other macros?  Or is this sort of 
functionality not supported, e.g. implement all behavior in sectionIndex

rather than calling mochaLink in turn?

Thanks,
Derek


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


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


Mime
View raw message