代码之家  ›  专栏  ›  技术社区  ›  Gad D Lord

如何在{if}条件中使用jTemplates的$P参数

  •  0
  • Gad D Lord  · 技术社区  · 15 年前

    是否可以使用jTemplates $P.imagesPerRow 参数在 {#if} 情况如何?

    它为我提出了“未预料到的12”例外。

    {#foreach $T as record}
        {#if $T.record$index % {$P.imagesPerRow} == 0}
            </tr>
            <tr>
        {#/if}
        <td class='image-preview-cell' style='width: {$P.cellWidth}; height: {$P.cellHeight}'>
        <img src='{$T.record.url}' title='{$T.record.title}' alt='{$T.record.title}'/>
    </td> 
    {#/for}
    
    1 回复  |  直到 13 年前
        1
  •  1
  •   Alex York    15 年前

    我还没有测试过,这只是一种预感,但是试着改变这条线:

    {#if $T.record$index % {$P.imagesPerRow} == 0}
    

    对此:

    {#if $T.record$index % $P.imagesPerRow == 0}