当前位置: 移动技术网 > IT编程>网页制作>CSS > freemarker常用指令分享

freemarker常用指令分享

2018年02月04日  | 移动技术网IT编程  | 我要评论

freemarker常用指令分享

<!--模板包含某个页面-->
<#include "header.ftl"> 
.....
<#include "footer.html">
 
<!--输出值不为null的标题-->
${question.title!}
 
<!--判断followed 为true-->
<#if followed>
    <button>取消关注</button>
<#else>
    <button>关注问题</button>
</#if>
 
<!--判断followed 不为null且存在值-->
<#if vo.followed ??>
    <button>取消关注</button>
<#else>
    <button>关注</button>
</#if>
 
<!--输出个数-->
<a href="">${followUsers?size}</a>人关注该问题
 
<!--循环list-->
<#list followUsers as vo>
        <img src="${vo.headUrl}">
</#list>
 
<!--输出日期格式-->
${(comment.comment.createdDate)!?string("yyyy-MM-dd HH:mm:ss")}
 
 
<!--list中循环调用宏-->
<#macro comment_question vo>
    ${vo.questionTitle}
</#macro>
 
<#macro follow_question vo>
    ${vo.questionTitle}
</#macro>
 
 <#list feeds as feed>
        <#if feed.type ==1>
               <@comment_question vo=feed />
        <#elseif feed.type==4>
               <@follow_question vo=feed/>
        </#if>
</#list>

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网