简体   繁体   English

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

[英]How to use jTemplates' $P parameters within a {#if} condition

Is it posible to use jTemplates' $P.imagesPerRow parameter inside the {#if} condition? 是否可以在{#if}条件内使用jTemplates的$P.imagesPerRow参数?

It raises "Uncaught 12" exception for me. 它为我提出了“未捕获的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}

I haven't tested this, and it is just a hunch, but try and change this line: 我还没有测试过,这只是一种预感,但是请尝试更改此行:

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

to this: 对此:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM