Re: [SMARTY] simple loops?
| From: | messju mohr | Date: | Mon, 04 Apr 2005 08:46:37 +0000 |
| Subject: | Re: [SMARTY] simple loops? | ||
| References: | 1 2 3 4 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-12393@lists.php.net to get a copy of this message | ||
On Mon, Apr 04, 2005 at 03:18:25PM +0900, D_C wrote:
> hiya -
>
> is there a way to do a simple iteration loop in smarty, if I dont have
> an object to iterate over? eg if i want to put in X lines of
> spacing...
>
> {foreach var="i" start="0" end="10" step="1" }
> ... do something
you can use sections for that:
{section name=i loop=10} ... {/section}
(see: http://smarty.php.net/manual/en/language.function.section.php)
> or can i call a PHP function inline to return text?
yes, with a modifier:
{" ... "|str_repeat:10}
(see: http://smarty.php.net/manual/en/language.modifiers.php)
greetings
messju
> tx!