Trong file test ở bài 1 mình đã tạo, giờ thay đỏi tí thôi
<?php
require 'libs/Smarty.class.php';
$smarty = new Smarty;
$smarty->assign('title','Contact Detail');
$smarty->assign('contact',array('id'=>1,
'name'=>'smagic39',
'email'=>'smagic39 chấm cơm chấm gạo',
'phone'=>'99999999999'
));
$smarty->display('test.tpl');
?>
<html>
<head>
<title>{$title}</title>
</head>
<body>
id : {$contact.id} <br>
name : {$contact.name} <br>
email : {$contact.email} <br>
phone : {$contact.phone} <br>
</body>
</html>
Sự khai báo contact =new array(); cũng chắng khá là mấy,hoặcCái này sẽ dễ hiểu hơn thì phải:
{assign var=foo value=[1,2,3]}
{assign var=foo value=['y'=>'yellow','b'=>'blue']}
{assign var=foo value=[1,[9,8],3]}
No comments:
Post a Comment