RE: [SMARTY] Getting a value from an array using a variable as reference

From: Date: Mon, 15 Sep 2003 13:56:04 +0000
Subject: RE: [SMARTY] Getting a value from an array using a variable as reference
Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-10208@lists.php.net to get a copy of this message
Humm, try with something like this, it should work: test.php $S = new Smarty(); $SessionVars["key1"]["grp_id"]="value"; $MenuItem["ThisStep"]="key1"; $S->assign('MenuItem',$MenuItem); $S->assign('SessionVars',$SessionVars); $S->display('test.tpl'); test.tpl {assign var=tmpKey value=$MenuItem.ThisStep} Key: {$tmpKey} <- (ke1) Result: {$SessionVars.$tmpKey.grp_id} <- (value) -----Mensaje original----- De: Thomas Pilgaard Miller [mailto:ascii@microcore.dk] Enviado el: lunes, 15 de septiembre de 2003 15:12 Para: smarty-general@lists.php.net Asunto: [SMARTY] Getting a value from an array using a variable as reference Hi list, I have such a hard time figuring out how to achieve the following: {$SessionVars[$MenuItem.ThisStep].grp_id} The problem is that it won't compile. I am trying to retrieve the value from $SessionVars['Position'].grp_id by the use of $MenuItem.ThisStep Can anyone tell me how to go about this. Any help is appreciated. Thanks in advance, Thomas -- Smarty General Mailing List (http://smarty.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

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