freemarker(2)


${"list iterator"}
<#list 1..6 as x>
  <#if x%2==0>
  ${x} <#break>
  </#if>
</#list>
<br>

${"***********************************************"}<br>
${"include  file"}<br>

<#include "/test.txt" encoding="utf-8">
<br>
${"***********************************************"}<br>

<#include "*/test.txt"><br>

${"***********************************************"}<br>

<#import "/design/copyright.ftl" as my>

<@my.copyright date="2008"/>
${my.mail}
<#assign mail="[email protected]"/><br>
${mail}<br><br><br>

${"在导入的名称空间中创建或者替换变量"}<br>
${"替换变量"}<br>
<#import "/design/copyright.ftl" as my>
${"原始 e_mail:"}${my.mail}<br>

${" 替换之后的Email :"}
<#assign mail="[email protected]" in my>
${my.mail}<br>

<#assign mail="${map.name}@163.com">
${mail}
${"***********************************************"}<br>

${"将结果保存到一个变量中"}<br>

<#macro myMacro>foot</#macro>
<#assign n>
<#list 1..6 as x>
    ${x}    <@myMacro /><br>
</#list>
</#assign>
${n?word_list?size}<br>
${n}

你可能感兴趣的:(freemarker,Yahoo)