freemarker template for loop statement

和自甴很熟 提交于 2019-12-05 00:09:34
Laabidi Raissi

From the Freemarker manual you can do:

<#assign x=3>
<#list 1..x as i>
  ${i}
</#list>

Edit: Beware, if x is 0 (or less), it will count backwards. So you mostly want 1 ..< x, which excludes x (this requires FreeMarker 2.3.22).

longhua

You can use list directive:

<ul>
<#list 1..2 as index>
    <li>${index}</li>
</#list>
</ul>
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!