AnsweredAssumed Answered

Display documents with categories using Templates

Question asked by aswini on Jan 22, 2009
Latest reply on Jan 23, 2009 by aswini
Hi All,

I am trying to create a Presentation Template (Freemarker template) to customise my folder view. On the selected space, the custom view should show the details only for those documents that contain categories. I have written the following FTL template. But, it shows a big vacant space in my custom view. I assume its because the files in the space does not contain categories assigned to it. Can you suggest where am I going wrong please.

Thank you
Aswini



<html><head></head>
<body>
<#– Table of docs in a specific folder –>
<h3>${space.name} documents</h3>
<table cellpadding=2 border=0 style="BORDER: 1px;">
    <tr>
        <td></td>
        <td><b>Name</b></td>
        <td><b>Last Modified</b></td>
        <td><b>Categories</b></td>
    </tr>
        <#assign query = ".//*[subtypeOf('cm:content')]">
        <#list space.childrenByXPath[query] as child>
           <tr>
                    <#if child.properties["cm:categories"]?exists>
                        <td><a href="/alfresco${child.url}" target="new"><img src="/alfresco${child.icon16}" border=0></a></td>
                        <td><a href="/alfresco${child.url}" target="new">${child.properties.name}</a></td>
                        <td>${child.properties["cm:modified"]?string("dd-MMM-yyyy hh:mm")}</td>
                        <td>
                            <#list child.properties["cm:categories"] as prop>
                            ${prop.name}<br/>
                            </#list>
                        </td>
                    </#if>
            </tr>
        </#list>
</table>
</body>
</html>

Outcomes