cancel
Showing results for 
Search instead for 
Did you mean: 

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

milonette_
Star Collaborator
Star Collaborator

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

3 REPLIES 3

milonette_
Star Collaborator
Star Collaborator

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>

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"...

Question ref created