1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
|
class maClasse {
private $id = -1;
public function __construct() {
$this->id = rand(); // On considère qu'il renvoi entre 0 et 6 pour l'exemple
}
public function getId() {
return $this->id;
}
}
$oSmarty = new Smarty();
$tableau[] = new maClasse();
$tableau[] = new maClasse();
$tableau[] = new maClasse();
$tableau[] = new maClasse();
$tableau[] = new maClasse();
$jours = array();
$jours[0] = 'Dimanche';
$jours[1] = 'Lundi';
$jours[2] = 'Mardi';
$jours[3] = 'Mercredi';
$jours[4] = 'Jeudi';
$jours[5] = 'Vendredi';
$jours[6] = 'Samedi';
$oSmarty->assign('tableauObj', $tableau);
$oSmarty->assign('jours', $jours);
$oSmarty->display('index.tpl'); |
Partager