V
V
Vladimir Banduristov2014-09-13 09:23:55
Smarty
Vladimir Banduristov, 2014-09-13 09:23:55

How to remove extra iteration in Smarty loop?

Good day to all. The crux of the matter is as follows. There is an array and I bypass it in a foreach loop.
To add tr I use " is div by ".

{foreach key=key name=goods_name item=c from=$goods}
<tr>
  <td>{$c.name}</td>
  {if $smarty.foreach.goods_name.iteration is div by 4}
    </tr><tr>
  {/if}
</tr>
{/foreach}

The array has 20 elements. It should output 5 lines. And as a result, an empty string is created at the end without td. Why? And how to remove it?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question