Re: Replacing smarty variable from an associative array's values
| From: | Ben Finney | Date: | Sat, 08 Feb 2003 21:51:02 +0000 |
| Subject: | Re: Replacing smarty variable from an associative array's values | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-7600@lists.php.net to get a copy of this message | ||
On Sat, 8 Feb 2003, "gawan" wrote:
> Country: {$ISO3166_CODE_TO_NATURAL[{$Country}] }won't work, but what
> would?
You've misunderstood the syntax of a Smarty tag:
<http://smarty.php.net/manual/en/language.basic.syntax.php>
The { } delimiters enclose a complete Smarty tag; you don't use them
again within the tag, they'll just be seen as garbage syntax.
This should work:
{$ISO3166_CODE_TO_NATURAL[$Country] }
Don't think of
{$variable}
as
{$ variable }
Instead, think of it as
{ $variable }
Hope that helps.
(Dear doc-maintainers: any chance we could revisit that page in the
documentation and have the { } meaning made a bit clearer? It's all too
easy to come to this erroneous conclusion.)
--
\ "Remember men, we're fighting for this woman's honour; which is |
`\ probably more than she ever did." -- Groucho Marx |
_o__) |
bignose@zip.com.au F'print 9CFE12B0 791A4267 887F520C B7AC2E51 BD41714B