Concatenated string as array index

From: Date: Wed, 26 May 2004 15:21:48 +0000
Subject: Concatenated string as array index
Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-11412@lists.php.net to get a copy of this message
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

« previous php.smarty.general (#11412) next »