example3.tpl
CODE:[Copy to clipboard]<html>
<head><title>模板中内定的一些函数</title></head>
<body>{assign var="UserName" value="大师兄"} 
这里将显示模板内部定义的一个变量:UserName = {$UserName}下面的这一行将显示3个checkBox:<br>
{html_checkboxes name="CheckBox" values=$CheckName checked=$IsChecked output=$value separator="<br />"}
下面在这一行将显示3个radio:<br>
{html_radios name="RadioBox" values=$RadioName checked=$IsChecked output=$value separator="<br />"}
下面显示一个月,日, 年选择框:<br>
{html_select_date}<hr><b>CopyRight(C) By XiaoJun, Li 2004<b>{mailto address="[email protected]" text="联系作者"}</body>
</html>
example3.php
PHP:[Copy to clipboard]
<?phprequire_once ("./comm/Smarty.class.php");$smarty = new Smarty();
$smarty->template_dir = './templates/';
$smarty->compile_dir = './templates_c/';
$smarty->config_dir = './configs/';
$smarty->cache_dir = './cache/';
$smarty->caching = false;$smarty->assign('CheckName', array(
1001 => '语文',
1002 => '数学',
1003 => '外语'));
$smarty->assign('IsChecked', 1001);
$smarty->assign('RadioName', array(
1001 => '语文',
1002 => '数学',
1003 => '外语'));
$smarty->assign('IsChecked', 1001);
$smarty->display("example3.tpl");
?> 
输出结果复选框和单选框都没有后边的值,只有框,为什么?