Reputation: 35
I'm a little new to freemarker (I'm a PHP guy really!)
I'm trying to evaluate a variable value as Freemarker, for example:
variable offers contains:
<#list blahs as blah> <#if blah> <p>${blah.foo}</p> </#if> </#list>
And then evaluate the above variable in Freemarker, so like below:
<#assign textWithFreemarker = r"${offers}"/>
<#assign evaluatedFreemarker = textWithFreemarker?interpret />
<h1>${evaluatedFreemarker}</h1>
It gives me a template error:
content: Expected a string or something automatically convertible to string (number, date or boolean), but this evaluated to a transform.
Do I have to convert the type first?
Any help is much appreciated.
Upvotes: 2
Views: 1910
Reputation: 31162
If you need to interpret offers
as FTL to generate output inside that h1
element, you just need to write:
<h1><@offers?interpret /></h1>
Upvotes: 4