FreeMaker实现变量求和
今天在项目上遇到统计分页页面的某个字段的总和,前台页面是使用FreeMaker实现的,记录一下:
<#assign tprice = 0 > <#list orderlist as order > <#if order.price??> <#assign tprice = tprice + order.price > </#if> </#list>
${tprice } <!#-- 输出结果 -->
do what U love , love what U do ! 路漫漫其修远兮,吾将上下而求索
今天在项目上遇到统计分页页面的某个字段的总和,前台页面是使用FreeMaker实现的,记录一下:
<#assign tprice = 0 > <#list orderlist as order > <#if order.price??> <#assign tprice = tprice + order.price > </#if> </#list>
${tprice } <!#-- 输出结果 -->