Page 1 of 1

Help on coding

Posted: Wed May 06, 2009 8:47 pm
by aeroheli
Hi, I would like to add a condition in this code to have the forum insert "</tr><tr>" if the {counter} hits 3, can someone help me? Thank you so much!


Code: Select all

{foreach item="image" from=$records}
 
 
        <td>
        {if $use_fancy_urls}
            <a href="listings/view/{$image.make|strip:"-"}/{$image.model|strip:"-"}/
 
{$image.listingid}/"><img src="{$image.imagethumbpath}" title="{$smarty.const.IMAGE} {counter}" 
 
alt="{$smarty.const.IMAGE} {counter}" /></a><br><br><b>{$image.ad_title}</b><br></td>
 
 
 
        {else}
            <a href="listings.php?make={$image.make|strip:"-"}&model=
 
{$image.model|strip:"-"}&id={$image.listingid}"><img src="{$image.imagethumbpath}" 
 
title="{$smarty.const.IMAGE} {counter}" alt="{$smarty.const.IMAGE} {counter}" /></a><br><br><b>
 
{$image.ad_title}</b><br></td>
 
        {/if}
    
 
 
 
 
{/foreach}

Re: Help on coding

Posted: Wed May 06, 2009 8:53 pm
by Gabriel
That's not too hard. Insert this wherever you want that:

Code: Select all

{if $counter == 3}
</tr><tr>
{/if}

Re: Help on coding

Posted: Wed May 06, 2009 9:02 pm
by aeroheli
Doesn't work :(

Re: Help on coding

Posted: Wed May 06, 2009 9:06 pm
by Gabriel
It looks like you're using Smarty. Maybe I have something wrong or you're inserting it incorrectly. Have a look at the Smarty conditionals manual. If you've inserted it, look for your "templates_c" directory or something similar and delete the files in it to force Smarty to regenerate any templates it may be caching. That should fix it. If not, let me know.