velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robert Douglass" <r.dougl...@onlinehome.de>
Subject RE: macros calling macros - the answer
Date Sat, 04 Oct 2003 09:57:19 GMT
It was a type conversion problem.

#macro( hyperlink $hyperlinkId)
####### THIS WORKS WHEN toString() IS CALLED
#set($hyperlinkDoc = $dataBase.getDocument($hyperlinkId.toString()))
$linkDoc
#end


-----Original Message-----
From: Robert Douglass [mailto:r.douglass@onlinehome.de]
Sent: Friday, October 03, 2003 10:12 PM
To: Velocity list
Subject: macros calling macros


I'm really sorry if the answer to this is in the mail archive, but I
couldn't find it.

#macro( hyperlink $hyperlinkId)
####### THIS SET DOESN'T WORK WHEN CALLED FROM NAVIGATION
#set($linkDoc = $dataBase.getDocument($hyperlinkId))
$linkDoc
#end

#macro( navigation $widgetId)
#set($navdoc = $dataBase.getDocument($widgetId))
#set($hyperlinks = $navdoc.applyDocumentPath('Hyperlinks'))
#foreach( $link in $hyperlinks )
#hyperlink($link.getIdValue())
#end
#end

I call #hyperlink from within #navigation. The variable $hyperlinkId and the
variable $dataBase are both right, but the line #set($linkDoc =
$dataBase.getDocument($hyperlinkId)) doesn't result in a method call. When I
call hyperlink directly, it works fine. Is can't be a type-conversion
problem -- getDocument(String id) -- as I use the same syntax elsewhere, so
I figure it must be a scoping/context problem. I've read the documentation,
and I've been on and off of this list for half a year, but alas, I just
don't understand.

Thanks in advance,

Robert Douglass


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


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


Mime
View raw message