在模板index.html里有一段:
{{php}} show_list('hot','2','5','32','','') {{/php}}
在index.php里有:
function show_list($type,$class_id=0,$maxLine='',$subnum='',$dateformat='Y:m:d',$tplname) {
$subnum=(int)$subnum;
global $smarty;
global $db;
switch ($type) {
case 'hot':
if($class_id=='' || $class_id==0){
$where = '';
}
else
$where="where parent_id='$class_id'";
$smarty->assign("more","list.php?parent_id=".$class_id);
if($maxLine=='')
$limit='';
elseif(preg_match("/^[0-9]+,[0-9]+$/", $maxLine)){
$sql= "select * from news $where Order by num DESC";
$rs = $db->SelectLimit($sql, $maxLine, 0);
if ($rs) {
while( $ar = $rs->FetchRow()) {
$row[] = array("HotUrl"=>"info.php?id=".$ar['id'],
"HotParent_id"=>"&parent_id=".$ar['parent_id'],
"HotTopic"=>substr($ar['topic'],0,$subnum),
"HotTime"=>date($dateformat,$ar['date']));
// if($tplname=='')
//$tplname = '../templates/hot_list.html';
$smarty->assign("hot_list",$row);
$smarty->display("../templates/hot_list.html");
}
}
}
break;
}
}
hot_list.html'的代码为:
但是hot_list.html'模板没有显示在index.html模板的相应位置,说明没有调用成功,请问是什么问题?谢谢!