Re: horizontal loops with smarty

From: Date: Thu, 24 Feb 2005 03:38:29 +0000
Subject: Re: horizontal loops with smarty
References: 1 2 3  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-12257@lists.php.net to get a copy of this message
* Willy Mularto <sangprabv@gmail.com>: > Hi, > I want to do loop like this: > 1 2 3 4 5 > 6 7 8 9 10 > > I have problem to do horizontal loops with smarty, any solution with this? Use CSS and floats. Really. :-) {foreach from=$numbers item=num} <div style="width: 18%; right-margin: 1em; float: left;">{$num}</div> {/foreach} <div style="clear: both;">&nbsp;</div> The above will get five numbers across, as long as there's room for them in the browser width. A more complicated solution would be to use Smarty's iterators, and has been discussed in this list before; search the archives for 'foreach iterators'. -- Matthew Weier O'Phinney | WEBSITES: Webmaster and IT Specialist | http://www.garden.org National Gardening Association | http://www.kidsgardening.com 802-863-5251 x156 | http://nationalgardenmonth.org mailto:matthew@garden.org | http://vermontbotanical.org

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