Section loops and Arrays
| From: | Andreas Kossmeier | Date: | Mon, 24 Sep 2001 15:11:28 +0000 |
| Subject: | Section loops and Arrays | ||
| Groups: | php.smarty.general | ||
| Request: | Send a blank email to php-smarty-general+get-1532@lists.php.net to get a copy of this message | ||
hi,
there've been several question on this mailing list for the problem of
looping through arrays with keys that doesn't start at 0 or associative
arrays.
the problem is the array handling of Smarty. in the compiled template
you've something like
for ($i = $start; $i <= $total; $i++) {
echo $sectionArray[$i]
}
and that's not working for assoc. arrays or arrays with e.g. arrays
starting at e.g. index 100.
currently you can't loop correctly through arrays like
array(4) {
[3]=>
string(1) "1"
[4]=>
string(1) "2"
[5]=>
string(1) "3"
[8]=>
string(1) "3"
}
or associative arrays. you've always to rewrite the array for use in
smarty. monte, andrei, any efforts to make this work in the future?
maybe using 'foreach' or a while...list...each construct?
regards
andreas
--
andreas kossmeier
bergfex.at - http://www.bergfex.at