section and multiple arrays
| From: | Valerie Delon | Date: | Mon, 15 Nov 2004 09:32:24 +0000 |
| Subject: | section and multiple arrays | ||
| Groups: | php.smarty.general | ||
| Request: | Send a blank email to php-smarty-general+get-11961@lists.php.net to get a copy of this message | ||
Salut!
I always got error message or even just white browser (without any output
all) when I use section and associative&multiple arrays since most of the
example from Manual about section always loop=integer values. (only one
associative loop=$contacts, not integer but not with PHP code).
What I was trying to do is :
{* smarty *}
{section name=customer loop=$contacts}
name : {$contacts[customer].name}<br>
home : {$contacts[customer].home}<br>
cell : {$contacts[customer].cell}<br>
e-mail : {$contacts[customer].email}<p>
{/section}
-----
<?php
include 'config3.inc.php';
$smarty = new Smarty_try;
$name = array('John Smith', 'Jack Jones', 'Jane Munson');
$home = array('555-555-5555', '666-666-6666', '777-777-7777');
$cell = array('111-111-1111', '222-222-2222', '333-333-3333');
$email = array('john@smith.com', 'jack@jones.com',
'jane@munson.net');
$contacts = array($name, $home, $cell, $email);
// print_r($contacts);die;
$smarty->assign('contacts', $contacts);
$smarty->display('section3.tpl');
?>
and I got trigger error.
Correction to this code above would be very welcome .
Valérie Delon
étudiante
--
On a besoin d'apprendre beacoup plus
Quelqu'un croit c'est trop
Mais j'crois que ce n'est pas assez