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