mirror of
https://github.com/smarty-php/smarty.git
synced 2025-11-02 21:31:48 +01:00
Added ability to index by key.
This commit is contained in:
@@ -10,11 +10,8 @@ $smarty->assign("LastName",array("Doe","Smith","Johnson","Case"));
|
||||
$smarty->assign("Class",array(array("A","B","C","D"), array("E", "F", "G", "H"),
|
||||
array("I", "J", "K", "L"), array("M", "N", "O", "P")));
|
||||
|
||||
$smarty->assign("Contacts",array(
|
||||
"phone" => "555-4444",
|
||||
"fax" => "555-3333",
|
||||
"cell" => "760-1234"
|
||||
));
|
||||
$smarty->assign("contacts", array(array("phone" => "1", "fax" => "2", "cell" => "3"),
|
||||
array("phone" => "555-4444", "fax" => "555-3333", "cell" => "760-1234")));
|
||||
|
||||
|
||||
$smarty->display("./templates/index.tpl");
|
||||
|
||||
@@ -25,13 +25,12 @@ My interests are:
|
||||
none
|
||||
{/section}
|
||||
|
||||
Contacts: {$Contacts}<br>
|
||||
testing
|
||||
{$Contacts["phone"]["cell"]}<br>
|
||||
{$Contacts["phone"]["fax"]}<br>
|
||||
{$Contacts["phone"]["home"]}<br>
|
||||
{$Contacts["phone"]["work"]}<br>
|
||||
{$Contacts["fax"]}<br>
|
||||
{section name=sec1 loop=$contacts}
|
||||
phone: {$sec1/contacts.phone}
|
||||
fax: {$sec1/contacts.fax}
|
||||
cell: {$sec1/contacts.cell}
|
||||
{/section}
|
||||
|
||||
<p>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user