围炉网

一行代码,一篇日志,一个梦想,一个世界

freemarker Example Recursive Template

  • 因在问道项目中用到下面的技术,因此记录一下

Example Recursive Template

Description

This template can be called from a space. It recursively walks down the subspaces and prints out the spaces. It should be used as a good starter for any type or recursive walks down the node tree.

Screenshot

Template

Full version

<#macro recurse_macro node depth>

<#if node.isContainer>

<tr>

    <td align='left'>(${depth})

     <#if (depth>0) >

         <#list 1..depth as i>.</#list>

     </#if>

        <img src="/alfresco${node.icon16}"> <a href="/alfresco${node.url}">${node.properties.name}</a>

    </td>

</tr>

<#list node.children as child>

    <#if child.isContainer && node.children?size != 0 >

         <@recurse_macro node=child depth=depth+1/>

    </#if>

</#list>

</#if>

</#macro>

<b>Recursive Listing of Spaces:</b>

<table border="1" celpadding="1" cellspacing="1">

<tr><th> Name Space </th></tr>

<@recurse_macro node=companyhome depth=0/>

</table>

Requirements

Alfresco Version 2.1.x It uses standard functionality provided in this version of Alfresco.

Source

See Template section above.

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注

沪ICP备15009335号-2