dynamic var
| From: | Martin Kloss | Date: | Tue, 19 Aug 2003 11:01:41 +0000 |
| Subject: | dynamic var | ||
| Groups: | php.smarty.general | ||
| Request: | Send a blank email to php-smarty-general+get-10093@lists.php.net to get a copy of this message | ||
hi there,
I know this has been discussed lots of times already, but
I can't seem to figure out how to do the following (simplified):
I have a 2-dim array $contents which looks like this:
$contents = array(array('content_de' = 'foo', 'conten_en' = 'bar'...)...));
Now I want to loop through the array to get the content
depending on the user's language setting:
{foreach from=$contents item="c"}
{$c.content_$language}
{/foreach}
But that doesn't work. Now how do you get the field name
dynamically assigned? I tried a couple of combinations with
quotes, but it wouldn't work.
Martin.
P.S. My previous problem has been solved. The php.ini on
the new server had safe_mode turned on, so it wouldn't allow
me to get anywhere below the web root.
Martin Kloss
martin.kloss@triquart.de
Technische Direktion
************************
Triquart Neue Medien
Bellealliancestr.17
20259 Hamburg
Germany
Tel.+49 (40)432 923-0
Fax +49 (40)432 923-23
www.triquart.de
www.triquart-humor.de
*************************
"Lingo objektorientiert"
Das Buch zum Autor jetzt bestellen unter:
http://www.amazon.de/exec/obidos/ASIN/3898422194/lingmmugd