{* 註解 *}
$name
=
"ugm"
;
$smarty
->assign(
'name'
,
);
{$name}
$user[
]=
'birthday'
"1969-11-25"
$smarty->assign(
'user'
, $user);
{$user.name} 的生日是 {$user.birthday}
$users
[1][
]="1969-11-25";
[2][
"adam"
"2000-07-06"
'users'
{foreach $users as $user}
{$user.name} 的生日是{$user.birthday}
{/foreach}
或
{$user.1.name} 的生日是 {$user.1.birthday}
{$user.2.name} 的生日是 {$user.2.birthday}
class user{
public $name = "Ugm";
public function sex(){
return "先生";
}
$user = new user;
$smarty->assign('user',$user); {$user->name}{$user->sex()}您好! 輸出結果:「Ugm先生您好!」
->clearAllCache();
{if $變數|in_array:$陣列}
{$user->name|upper}
{foreach $來源變數 as $別名}
{$別名.索引}
{foreachelse}
該變數沒有值時要出現的內容