代码之家  ›  专栏  ›  技术社区  ›  Tuxedo Joe

比较forloop.索引|模:4,带液体中0(果冻)

  •  0
  • Tuxedo Joe  · 技术社区  · 8 年前

    {%-如果forloop.index0|模:4==0-%}{%-endif-%}

    有什么想法吗?

    1 回复  |  直到 8 年前
        1
  •  2
  •   marcanuy    8 年前

    字符串的结尾 管 forloop.index0|modulo:4 == 0 .

    你必须分配 模 如果 对于 回路:

    {% assign loopindex = forloop.index0 | modulo: 4 %}
    {%- if loopindex == 0 -%}
    <p style="background-color:red">Hey look! I'm a fourth element</p>
    {%- endif -%}