Example Recursive Template
From AlfrescoWiki
Contents |
[edit] 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.
[edit] Screenshot
[edit] 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>
[edit] Requirements
Alfresco Version 2.1.x It uses standard functionality provided in this version of Alfresco.
[edit] Source
See Template secion above.


