Re: [SMARTY] Building arrays within templates
| From: | messju mohr | Date: | Thu, 03 Jul 2003 16:38:25 +0000 |
| Subject: | Re: [SMARTY] Building arrays within templates | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-9828@lists.php.net to get a copy of this message | ||
On Thu, Jul 03, 2003 at 04:24:02PM +0100, Mark Rogers wrote:
> Is it possible to build arrays within templates? (Eg for passing to other
> template functions.)
>
> Eg, what I'd like to do is:
> {include file="mytemplate.tpl" data[]="line1" data[]="line2"
> data[]="line3"}
>
> .. where mytemplate.tpl includes a loop to handle $data. [I know this
> doesn't work, but maybe there's a syntax that does?]
there is no nice syntax for this. you can do sth. like
{include file="mytemplate.tpl" data=","|explode:"line1,line2,line3"}
which is an ugly hack.
> Similarly for {assign var="data[]" value="Line1"}?
>
> --
> Mark Rogers, More Solutions Ltd