Displaying all spaces and sub-spaces recursively
By now, you may have understood how to display the contents of a particular space.
But you know Alfresco spaces are hierarchical and these can be very complex—much like the MS Windows folder structure. So what if we want to display all the spaces and sub-spaces under the current space?
How to do it...
1. In the Company Home > Data Dictionary > Presentation Templates space, create a new content. Let's name it all_spaces.ftl.
2. Add the following template code:
<#macro return_spaces 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 > <@return_spaces node=child depth=depth+1/> <...