2010-11-25 54 views
0

在条件中使用jTemplates的$P.imagesPerRow参数有可能吗?

它为我提出了“未捕获的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

我没有测试过这一点,它仅仅是一种预感,但试图改变这一行:

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

这样:

{#if $T.record$index % $P.imagesPerRow == 0} 
相关问题