[prev in list] [next in list] [prev in thread] [next in thread]
List: smarty-general
Subject: [SMARTY] Concatenated string as array index
From: Gabriel Birke <birke () kontor4 ! de>
Date: 2004-05-26 15:21:48
Message-ID: 6815ACFC-AF28-11D8-AB3D-003065FA313E () kontor4 ! de
[Download RAW message or body]
Hello!
I've got the following array:
$entry = array(
"text_de" => "Deutscher text",
"text_en" => "english text"
"head_de" => "Deutsche Ueberschrift",
"head_en" => "english headline"
);
The variable $l stores the locale abbreviation ("en" or "de")
Something like
echo $entry["head_".$l]."<br>".$entry["text_".$l];
is very elegant. Is a statement like this possible in Smarty?
Or do i have to assign the correct field names from php like this:
$smarty->assign("text_local", "text_".$l);
$smarty->assign("head_local", "head_".$l);
In the template:
{$entry.$head_local}<br />{$entry.$text.local}
With best regards
Gabriel Birke
--
KONTOR4_Neue Medien
Plathnerstraße 5
30175 Hannover
Fax: +49 51184 48 98 99
mailto:birke@kontor4.de
http://www.kontor4.de
--
Smarty General Mailing List (http://smarty.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic