Re: [SMARTY] Concatenated string as array index
| From: | Thomas Pundt | Date: | Thu, 27 May 2004 08:18:56 +0000 |
| Subject: | Re: [SMARTY] Concatenated string as array index | ||
| References: | 1 2 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-11414@lists.php.net to get a copy of this message | ||
Hi,
On Wednesday 26 May 2004 17:38, David Förster wrote:
| I don't think that's possible. I'd rather recommend to change the array
| slightly:
|
| $entry = array(
| "de" => array(
| "text" => "Deutscher text",
| "head" => "Deutsche Ueberschrift",
| )
| "en" => array(
| "text" => "english text",
| "head" => "english headline",
| )
| );
|
| That'd be easier to handle.
yes, I've done it that way, too:
$lang = array(
"de" => array(
"text" => "Deutscher text",
"head" => "Deutsche Ueberschrift",
)
"en" => array(
"text" => "english text",
"head" => "english headline",
)
);
$tpl->assign("lang",$lang[$language]);
and in the template use {$lang.text} and {$lang.head} - quite simple.
Ciao,
Thomas
--
Thomas Pundt -------------------------- http://pundt.de/
---------------------
EMail: Thomas Pundt <thomas@pundt.de> | Schlossstrasse 42, D-40477 Duesseldorf