Re: A better way to create a table based on the number of elements

From: Date: Wed, 26 Feb 2003 00:39:13 +0000
Subject: Re: A better way to create a table based on the number of elements
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-8180@lists.php.net to get a copy of this message
Jun wrote: I have a solution! But, if there are other ways ( a better way) to accomplish what I want to do.. please post it here.. thanks What i did was, to get the modulo of section's current row number and try to check if it is ZERO. {if $error_message neq ""} {include file="error-box.tpl" title="Gallery Error" message=$error_message} {/if} <TABLE WIDTH = 350 CELLPADDING=5 cellspacing=5 border=0 > <TR> {section name=itemlist loop = $itemsarray} {math equation="x % 2" x=$smarty.section.itemlist.rownum assign=modulo} <TD ALIGN="center"> <font size=1 face=verdana,arial> <a href="#" onClick="returnprod_details('$CAT,{$itemsarray[itemlist].prod_id|escape:"url"}');"><img src="{$ITEM_DIR}{$ITEM_THUMB_PREFIX}{$itemsarray[itemlist].prod_image_file}" alt="{$itemsarray[itemlist].prod_id}" border=0 align="{cycle values="left"}"></A><br> <B><font color=#ff0000>{$itemsarray[itemlist].prod_id}</font><br> <font size=1 > {$itemsarray[itemlist].prod_desc} </font> <div align=right><a href="#" onClick="openCart('{$itemsarray[itemlist].prod_id}',1,{$CART_ID}); return false;">add to inquiry</A></div> </font> </TD> {if $modulo eq 0 } </TR> {if $smarty.section.itemlist.last == false} <TR> {/if} {/if} {/section} </TABLE> -- ------------------------------------- its never enough

« previous php.smarty.general (#8180) next »