Jump to content

[SOLVED] How make a count


davidcalabuig

Recommended Posts

Let's see if we all can help me :)
 
I want to make a count of images that when images of thumbs have more than 3 pictures, this images won't appear.
 
I created a variable  "ImagenesTumb" for the counter images, but I have problems with the allocation of value.
 
Thank you very much to all
 
var imagenesTumb = '{0|intval}';

{if $imagenesTumb < 2}
<li id="thumbnail_{$image.id_image}">
<a href="{$link->getImageLink($product->link_rewrite, $imageIds, 'thickbox_default')}" rel="other-views" class="thickbox {if $smarty.foreach.thumbnails.first}shown{/if}" title="{$image.legend|htmlspecialchars}">
<img id="thumb_{$image.id_image}" src="{$link->getImageLink($product->link_rewrite, $imageIds, 'medium_default')}" alt="{$image.legend|htmlspecialchars}"  />
</a>
</li>
{assign var=imagenesTumb value=imagenesTumb+1}
{/if}

 

Edited by calabuig (see edit history)
Link to comment
Share on other sites

Don't forget to use the old variable with the $ in the front.

 

{assign var=imagenesTumb value=$imagenesTumb+1}

 

or, shorter maybe:

 

{$imagenesTumb = $imagenesTumb +1}

 

Just checking, but, Is this code part:

{if $imagenesTumb < 2}
<li id="thumbnail_{$image.id_image}">
<a href="{$link->getImageLink($product->link_rewrite, $imageIds, 'thickbox_default')}" rel="other-views" class="thickbox {if $smarty.foreach.thumbnails.first}shown{/if}" title="{$image.legend|htmlspecialchars}">
<img id="thumb_{$image.id_image}" src="{$link->getImageLink($product->link_rewrite, $imageIds, 'medium_default')}" alt="{$image.legend|htmlspecialchars}"  />
</a>
</li>
{assign var=imagenesTumb value=imagenesTumb+1}
{/if}

within some foreach loop or so, otherwise this code will always be printed anyways (because imagenesTumb has value 0 at the beginning, which is always < 2...)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...