核心提示:freemarker常用指令分享!--模板包含某个页面--#include header.ftl .....#include footer.html !--输出值不为null的标题--${questi...
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>


