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.

此条目发表在未分类分类目录,贴了标签。将固定链接加入收藏夹。