RE: [SMARTY] Array keys, values

From: Date: Mon, 15 Oct 2007 20:41:47 +0000
Subject: RE: [SMARTY] Array keys, values
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-13778@lists.php.net to get a copy of this message
Christoph Boget wrote: >If I have an array that looks like this: >Array ([Salary] => Array ( [0-50K] => Array ( [filterType] => range ) ) ) > >How can I access the key values? Individually, that is. What about the >child array key/values? Individually, that is. {$myArray.Salary.0-50K.filterType} should work, but the key 0-50K might be problematic due to the leading numeric character (I haven't tried it). If it doesn't work, try adding a leading alpha char to those key names. -- Max Schwanekamp NeptuneWebworks.com 541-517-9064 How can I access the key values? Individually, that is. What about the child array key/values? Individually, that is. In the template, I've tried: {$myArray[0]} {$myArray[0].filterType} {$myArray[0][0]} Nothing seems to work. I know how to iterate through the entire array and display the contents that way, but I don't know how to get the key/value of just one particular element (and/or any child arrays of that element). Any help would be greatly appreciated! thnx, Christoph

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