#ftl strict_syntax="false">
A simple test follows:
${message}
Now perform function tests:
<#assign urls = {"home" : "/home.html", "about" : "/about.html"}> <#assign images = {"home" : "/images/home.png", "about" : "/image/about-us.jpeg"}> <#assign preferences = {"showImages" : true}>Function is defined, now let's call it:
Again, but with different parameters:
<@français url=urls.about image=images.about alt="About Us" /> <#if var?exists> Something is wrong here.A recursive function call:
Test "catch-all" macro parameter:
<#macro "catch-all" foo bar...> foo=${foo} baz=[<#list bar?keys as key>${key}=${bar[key]}<#if key_has_next>, #if>#list>] #macro> <#assign catchall = .namespace["catch-all"]> <@catchall foo="a"/> <@catchall foo="a" bar="b"/> <@catchall foo="a" bar="b" baz="c"/> <#macro fmt pattern args...> <#list args as arg> <#local pattern = pattern?replace("{" + arg_index + "}", arg)> #list> ${pattern}<#lt> #macro>