Associative arrays question
| From: | Alain Fontaine - Consultant and developer | Date: | Thu, 03 Jan 2002 10:30:25 +0000 |
| Subject: | Associative arrays question | ||
| Groups: | php.smarty.general | ||
| Request: | Send a blank email to php-smarty-general+get-2483@lists.php.net to get a copy of this message | ||
Hello everyone, and a happy new year 2002! ;)
I have a question with regard to associative arrays. Given the associative
array below:
$arrCriteresRecherche = array( "SalleAManger" => "Salle à
manger",
"Jardin" => "Jardin",
"Garage" => "Garage",
"Parking" => "Parking",
"Ascenseur" => "Ascenseur",
"Cave" => "Cave",
"Renove" =>
"Rénové",
"GrenierMansarde" => "Grenier/Mansarde",
"AppartGardien" => "Appartement gardien",
"ChambreFroide" => "Chambre froide" );
I wonder how I can build a {section} that would somehow work like this:
{section name=criteres loop=$arrCriteresRecherche}
<input type="checkbox" name="{$arrCriteresRecherche[criteres].KEY}"
value="{$arrCriteresRecherche[criteres].VALUE}">
{/section}
And all this WITHOUT having to use two different arrays, one for the names
and one for the values. The problem with this assoc. array is that I don't
know the array's keys by name because they might be built dynamically...
Thanks! ;)
-----------------------
Alain Fontaine
Consultant & Developer
VAlain S.A.
Tél: +32-4-2522950
-----------------------