Re: [SMARTY] accessing values in multi-dimensional associative arrays
| From: | Mark Rogers | Date: | Tue, 03 May 2005 08:45:12 +0000 |
| Subject: | Re: [SMARTY] accessing values in multi-dimensional associative arrays | ||
| References: | 1 2 3 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-12575@lists.php.net to get a copy of this message | ||
Christopher Townson writes:
> This works perfectly. However, attempting to mimic this foreach loop in
smarty
> fails. This is how I'm trying it (I've updated smarty config to use
xml-style
> delimiters):
> == start smarty code ==
> <smarty>foreach from="$doc.stylesheets.css.linked" key="key"
> item="stylesheet"</smarty>
> <link rel="<smarty>$stylesheet.rel</smarty>"
> type="text/css"
> href="<smarty>$stylesheet.href</smarty>"
> charset="<smarty>$stylesheet.charset</smarty>"
> title="<smarty>$stylesheet.title</smarty>"
> media="<smarty>$stylesheet.media</smarty>" />
> <smarty>/foreach</smarty>
> == end smarty code ==
I haven't had chance to look through this in full, but it looks to me like
the problem is the quotes around the from value in the foreach:
<smarty>foreach from="$doc.stylesheets.css.linked" key="key"
should be
<smarty>foreach from=$doc.stylesheets.css.linked key="key"
or (not recommended, but equivalent)
<smarty>foreach from="
$doc.stylesheets.css.linked"
key="key"
Mark Rogers,
More Solutions Ltd