Array indexes
You can reference arrays by their index, much like native PHP syntax.
Example 4-3. accessing arrays by index
index.php: $smarty = new Smarty; $smarty->assign('Contacts', array('555-222-9876', 'zaphod@slartibartfast.com', array('555-444-3333', '555-111-1234'))); $smarty->display('index.tpl'); index.tpl: {$Contacts[0]} {$Contacts[1]} {* you can print arrays of arrays as well *} {$Contacts[2][0]} {$Contacts[2][1]} OUTPUT: 555-222-9876 zaphod@slartibartfast.com 555-444-3333 555-111-1234
|
|