Page 1 of 1

[Solved]Products module detail template {if}{/if} question

Posted: Tue Aug 20, 2013 3:17 am
by jasnick
Using 1.11.7 and up to date modules

In detail template:

Code: Select all

<div id="imagebox">
 <ul class="img">
 <li><div>
<a href="{$entry->file_location}/{$entry->fields.photo1->value}" ><img src="{$entry->file_location}/{$entry->fields.photo1->thumbnail}"></a></div></li>
... through to 
<li><div>
<a href="{$entry->file_location}/{$entry->fields.photo10->value}"><img src="{$entry->file_location}/{$entry->fields.photo10->thumbnail}"></a></div></li>
</ul>
</div>
If a product has only 8 images, how do I make sure only 8 are shown and not the 2 empty boxes as well? I used {if}{/if} on another site to show only available contentblocks but not sure how to implement that here.

Would appreciate some advice.

Thanks

I've experimented with :

Code: Select all

{if $entry->fields.photo10->value}<li><div>
<a href="{$entry->file_location}/{$entry->fields.photo10->value}"><img src="{$entry->file_location}/{$entry->fields.photo10->thumbnail}"></a></div></li>{/if}
and this seems to work. Is it correct syntax?

Thanks

Re: Products module detail template {if}{/if} question

Posted: Tue Aug 20, 2013 7:17 am
by uniqu3
Your experiment seems ok. ;)

Re: Products module detail template {if}{/if} question

Posted: Tue Aug 20, 2013 7:26 am
by jasnick
Thanks! Its the first bit of $Smarty I have done on my own! ;D