Document template : get all a document path with "Title" and not "name"

Hello,

I would like do the same as : Xhtml : get all a document path with “Title” and not “name” but in document template (Code in freemarker) for email, pdf, xls extraction.

So I got a “Document” in my template and need to write it's path, not with the classic “name”, but with the “title” attribute of each element of the path.

Do you know how to do it ?

thank you

0 votes

1 answers

3255 views

ANSWER



I used a function, as I could :

<#function getPathWithTitle doc>
    <#local tabPath = doc.path?split("/") >
    <#local pathSize = tabPath?size >
    <#local currentDoc = doc >
    <#local resultPath ="" >
    <#list 1..pathSize-1 as i>
        <#attempt>
            <#local theDoc = currentDoc.parent >
        <#recover>
            <#local resultPath = currentDoc.title + "/" + resultPath >
            <#break>
        </#attempt>
        <#if theDoc?has_content >
            <#local resultPath = currentDoc.title + "/" + resultPath >
            <#local currentDoc = theDoc >
        </#if>
    </#list>
    <#return resultPath?html >
</#function>
0 votes



When user of UI try to render this document template with clic on an UI button it fails to get doc.parent with exception user can't read it"… When this document template is rendered by workflow this exception doesn't appear… So, I just add a recovery block to avoiding exception, but it's not the right solution :-(
10/18/2013