Loop a section of an array
| From: | Peter Bowyer | Date: | Mon, 03 Jun 2002 08:12:37 +0000 |
| Subject: | Loop a section of an array | ||
| Groups: | php.smarty.general | ||
| Request: | Send a blank email to php-smarty-general+get-4507@lists.php.net to get a copy of this message | ||
Hi,
If I hav ethe folowing structure:
$box = Array
(
[title] => Your articles
[empty] => You do not have any articles. Would you like to <a href="/articles/add_article.php">write one</a>?
[data] => Array
(
[0] => Array
(
[article_url] => island_railways_north_of_europe
[article_title] => Island Railways north of Europe
)
[1] => Array
(
[article_url] => a_trip_on_the_launceston_steam_railway
[article_title] => A trip on the Launceston Steam Railway
)
)) How do I loop the [data] section? I've tried the following that won't work: <ul> {* The following row needs to be looped *} {section loop=$box.data name=i} <li><a href="/articles/{$box.data[i].article_url}">{$box[i].article_title}</a></li> {sectionelse} <li>{$box.empty}</li> {/section} </ul> Thanks Peter --oOo-- Narrow Gauge on the web - photos, directory and forums! http://www.narrow-gauge.co.uk --oOo-- Glenbranter - Scottish narrow gauge in 009 http://glenbranter.narrow-gauge.co.uk --oOo--