Re: [SMARTY] if (!empty($array))

From: Date: Sat, 22 Mar 2003 21:39:34 +0000
Subject: Re: [SMARTY] if (!empty($array))
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-8832@lists.php.net to get a copy of this message
Bonjour Michael, {section name=count loop=$array} {if $smarty.section.count.first} <tr> {/if} <td>{$array[count]}</td> {if $smarty.section.count.last} </tr> {/if} {/section} Elgi Le samedi 22 mars 2003 à 22:23:40, vous écriviez : MK> hi, MK> i want to create table rows from an array. that works so far. but i want MK> to skip the table header if the provided array is empty. there is an MK> 'if' construct in smarty but i can't find any function to count the MK> array elements or test if it's empty. MK> who can help? MK> <table> MK> <tr> MK> <th>Header 1</th> MK> <th>Header 2</th> MK> <th>Header 3</th> MK> </tr> MK> {foreach from=$array item=element} MK> <tr> MK> <td>$element[0]</td> MK> <td>$element[1]</td> MK> <td>$element[2]</td> MK> </tr> MK> {/foreach} MK> </table> MK> bets regards, MK> michael

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