Creating custom loop block function

From: Date: Fri, 23 Dec 2005 09:19:21 +0000
Subject: Creating custom loop block function
Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-13193@lists.php.net to get a copy of this message
I need some help from someone who's got more experience than me with Smarty. I've been tasked to create a set of block functions for rendering tables. Here's what the syntax look like: ---proba.html--- {list data=$rows} {head} {column}1{/column} {column}2{/column} {column}3{/column} {/head} {rows} {cell} 0. {$SKU} {$data.SKU} {/cell} {cell} 0. {$brand} {$data.brand} {/cell} {cell} 0. {$model} {$data.model} {/cell} {/rows} {/list} ---end-of-file--- The $rows data is somethink like that: ---proba.php--- ..... $smarty->assign('rows', array( array( SKU => 1, brand => 11, model => 11, ), array( SKU => 2, brand => 22, model => 22, ), ) ); .... ---end-of-file--- I need to make the smarty_block_rows() block function loop over the data in $rows. In the same time I need to access the elements (SKU, brand, model) on each loop. The HTML for the block components are read from an external file. If you want to take a look at the code, please follow this link: http://kaloyan.info/loop.zip. Thanks in advance to all which will provide any help, comment or advice. K.

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