Re: [SMARTY] Building arrays within templates
| From: | messju mohr | Date: | Fri, 04 Jul 2003 08:39:15 +0000 |
| Subject: | Re: [SMARTY] Building arrays within templates | ||
| References: | 1 2 3 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-9835@lists.php.net to get a copy of this message | ||
On Fri, Jul 04, 2003 at 09:10:20AM +0100, Mark Rogers wrote:
> "messju mohr" writes:
> > 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.
>
> Hmm, OK - I might play with this and see if it makes the template easier to
> read, but probably not.
no, it wouldn't.
> Thinking about assign instead, re-writing it to take an array parameter in
> place of a var parameter would be trivial, ie instead of trying to make
> {assign var="data[]" value="Line1"}
> work we'd have
>
> {assign array="data" value="Line1"}
> and even
> {assign array="data" separator="," value="Line1,Line2,Line3"}
there is already sth. like that in the contrib-section of the
smarty-website. see:
http://smarty.php.net/contribs/plugins/view.php/function.assign_array.php
another plugin accomplishing this is discussed here:
http://www.phpinsider.com/smarty-forum/viewtopic.php?t=220
greetings
messju
> I might play with that instead.
>
> Mark Rogers,
> More Solutions Ltd