Gad D Lord
Gad D Lord

Reputation: 6772

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

Is it posible to use jTemplates' $P.imagesPerRow parameter inside the {#if} condition?

It raises "Uncaught 12" exception for me.

{#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}

Upvotes: 0

Views: 2651

Answers (1)

Alex York
Alex York

Reputation: 5450

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}

Upvotes: 1

Related Questions