I want to display 3 images per row. but the code show first row with 2(two) images then it shows 3 images next row. where is the problem of the code?
<table style="width: 99%;padding-top:30px;" dir="ltr" border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
{foreach from=$execommittee item=v name=cat}
{if $smarty.foreach.cat.iteration % 3 == 0 && $smarty.foreach.cat.iteration > 0}
</tr>
<tr>
{/if}
<td width="142">
<p style="text-align: center;" align="justify">
<img src="themes/{$themes}/resources/images/publications/{$v.efilename}" border="0" width="142" height="152" /></a></p>
<p style="text-align: center;" align="justify">{$v.ename}</p>
</td>
{/foreach}
</tr>
</tbody>
</table>
<table style="width: 99%;padding-top:30px;" dir="ltr" border="0" cellspacing="0" cellpadding="0">
<tbody>
{foreach from=$execommittee item=v name=cat}
<tr>
{if $smarty.foreach.cat.iteration % 3 == 0 && $smarty.foreach.cat.iteration > 0}
</tr>
<tr>
{/if}
<td width="142">
<p style="text-align: center;" align="justify">
<img src="themes/{$themes}/resources/images/publications/{$v.efilename}" border="0" width="142" height="152" /></a></p>
<p style="text-align: center;" align="justify">{$v.ename}</p>
</td>
</tr>
{/foreach}
</tbody>
</table>
your tr tags should be inside your loop. I'm not sure about that if statement, i think its not needed.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.