2012-10-29 221 views
0

假设我有两个宏,一个嵌套在另一个宏中。Freemarker - 将参数传递给嵌套宏

[#macro testNestingTOP id] 
    [#nested] 
[/#macro] 

[#macro testNesting] 
    id: ${id} 
[/#macro] 

使用

如何从testNesting宏检索ID特性参数的值?

[@testNestingTOP id='SOME VALUE'] 
 [@testNesting /] 
[/@testNestingTOP] 

回答

0

附加属性,你内心的宏并通过ID作为一个值,它

[@testNesting innerID ] 
//code 
[@testNesting /] 

[@testNestingTOP id='SOME VALUE'] 
    //code 
    [@testNesting innerID=id/] 
    //code 
[/@testNestingTOP] 

我希望这将有助于