Do advanced pdf templates support the `<#function>...
# advancedpdf
e
Do advanced pdf templates support the
<#function>
directive? I'm trying to replace characters in multiple strings but the function doesn't look to be called
c
Yeah, functions and macros are supposed.
e
Turns out it's being called, but this returns "HELLO".
Copy code
<#function decodeInput input>
                <#local temp = 'HELLO'>                          
                temp = temp?replace("L","O")
                <#return temp>
            </#function>
I guess the function can't return a variable, doing that replace in the return works. Weird
c
You gotta do <#assign temp = temp?replace("L","O")>
you don't have the assign directive there
e
<#assign
works,
<#local>
doesn't
not that it matters much, I'm working with
input
I'm not familiar with freemarkers namespace, I was worried about temp being availble outside of the function
c
You'll be fine if you just switch to <#assign ...> goin forward
may run into a function that does/doesn't work from time to time but if you aren't trying to be very fancy you should be able to find what you need.
👍 1