Re[2]: [SMARTY] Appending and prepending on a section?
| From: | Hendy Irawan | Date: | Wed, 31 Jul 2002 05:11:07 +0000 |
| Subject: | Re[2]: [SMARTY] Appending and prepending on a section? | ||
| References: | 1 2 3 4 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-5526@lists.php.net to get a copy of this message | ||
smarty-general,
> I don't understand what you mean when you say "[section] messes up associative
> arrays". Would you please elaborate?
Instead of looping through each entry, a {section} assumes the array
starts from 0 to count($array)-1.
so if I have an array like this
$array = array(1=>'hello', 2=>'yahoo');
what will happen if it's put into a {section} ?
First entry: (blank)
Second entry: 'hello'
'yahoo' will never be output/processed, since {section} assumes the
array starts from 0 to 1.
I'm not sure how associative arrays (with string indexes) are
processed by section, but judging by the above results, I think
sections are only good for super-formally-numeric-indexed arrays
(C-style arrays).
using foreach, any array is ok.
Salam hangat,
Hendy Irawan - www.GaulDong.NET
Kantor: (021) 5260467 [SoftVation]
Kos: (021) 5261839 [kamar 3]