JEECMS中FreeMarker的Macro

1.动态调用Macro,portlets从后台获取的数据
[#list portlets as portlet]
          <div class="box1">
            <div class="box_top"> 
              <span class="more"> <a href="${portlet.url}" target="_blank"> 更多 </a> &gt;&gt; </span>${portlet.name}
            </div>
            <!-- [#assign func="portlet"+portlet.id] ${func}-->
            [#assign func= portlet.mark]    <!-- 函数名变量 -->
            [@.vars[func] user.username/]   <!-- 动态调用macro  -->
          </div>
[/#list]
2.Macro函数
[#macro readblog username]
  	[@portlet name="${username}" sys="webscrap" site="readblog"]
		
		<table border="0"  style="LINE-HEIGHT:25px">
		
		[#list retList as list]
		
		  <tr>
		    <td><div class="icon-go"></div></td>
		    <td style="font-size: 16px;font-weight: bold;">
		    <a href="${list.href}" target="_blank">${list.title}</a>
		    </td>
		  </tr>
		  <tr>
		  	<td></td>
		    <td style="font-size: 10px;">${list.author }</td>
		  </tr>
		
		
		[/#list]
		</table>
	[/@portlet ]
[/#macro]

你可能感兴趣的:(JEECMS中FreeMarker的Macro)