I am trying to do something, but I can’t.
I have a table where the results are like this:
+----------+
|Dressing 1|
+----------+
|Dressing 2|
+----------+
|Dressing 3|
+----------+
|Dressing 4|
+----------+
|Dressing 5|
+----------+
|Dressing 6|
+----------+
|Dressing 7|
+----------+
|Dressing 8|
+----------+
|Dressing 9|
+----------+
But I want it to display it like this:
+----------+----------+----------+
|Dressing 1|Dressing 2|Dressing 3|
+----------+----------+----------+
|Dressing 4|Dressing 5|Dressing 6|
+----------+----------+----------+
|Dressing 7|Dressing 8|Dressing 9|
+----------+----------+----------+
Right now, I have a code like this:
<table cellpadding="6" border=0>
<tr style="height:20px">
{foreach from=$group.attributes name=awp_loop item=group_attribute}
{strip}
{assign var='id_attribute' value=$group_attribute.0}
<td align="center" {if $group.group_layout}valign="top"{/if}>
<div id="awp_checkbox_cell{$id_attribute}" style="{if !$group.group_layout}float:left;{else}width:100%;clear:left;{/if}">
{if $group.group_per_row > 1}<center>{/if}
<input style="border:none;margin:0;padding:0" type="checkbox" {if $group.attributes_quantity.$id_attribute == 0 && $awp_out_of_stock == 'disable'}disabled="disabled"{/if} class="awp_attribute_selected awp_group_class_{$group.id_group}" name="awp_group_{$group.id_group}" id="awp_checkbox_group_{$id_attribute}" onclick="awp_select('{$group.id_group|intval}',{$group_attribute.0|intval}, {$awp_currency.id_currency},false);" value="{$group_attribute.0|intval}" {if $group.default|is_array && $id_attribute|in_array:$group.default}checked{/if} />
{if $group.group_per_row > 1}</center>{/if}
</div>
</td>
{if $smarty.foreach.awp_loop.iteration < $group.attributes|@count && $smarty.foreach.awp_loop.iteration % $group.group_per_row == 0}
</tr>
<tr style="height:20px;">
{/if}
{/strip}
{/foreach}
</tr>
</table>
But I can’t figure out how to make the table or the code to only make 3 entries in a row.
If someone could help, it would be great.
I would use a list and float each
lielement left. That would give you your desired result and it would be a lot cleaner.http://jsfiddle.net/Zppya/
As for your table method… add a counter and use the mod/remainder function to determine every third element so you can create a new row.