phplib模板的问题。高分求解,成心求教
我的问题主要在
/**
* 代换模版变量 for note_list
*
* public the record @ 9-13-13:43
* with the template ...;note_list.ihtml;
* userid username notename passd description temptid regtime lastupdate isshow
*/
function showit_n_list($rule="ORDER BY 'exp'",$lim=""){
global $t,$conn,$how_note_user_table,$pagebar,$pb;
$conn->query("SELECT * FROM $how_note_user_table $rule DESC $lim");
if(!$conn->num_rows()){
warn_info("无记录");
}
else{
$t->set_file("main","note_list.ihtml");
$t->set_block('main','rows','p');
while ($conn->next_record()) {
$notename="<a href=./?n=note_display¬eid=".$conn->Record["noteid"].">".$conn->Record["notename"]."</a>";
$t->set_var("notename",$notename);
$t->set_var("username",$conn->Record["username"]);
if($conn->Record["isshow"]){
$t->set_var("description",$conn->Record["description"]);
}
else{
$description = "这个日记本已经被加密了,只有主人或者得到主人授权的人才能看到内容";
$t->set_var("description",$description);
};
$regtime = time_format($conn->Record["regtime"]);
$t->set_var("regtime",$regtime);
$t->set_var("exp",$conn->Record["exp"]);
$t->parse('p','rows',true);
};
$t->set_var("pagebar",$pagebar);
$t->parse("out",main);
};
//输出
// $t->p("out");
}
大家伙看看这段代码有否问题?没有输出是因为这个函数外面还有要加入的set_var,我准备在调用函数的叶面最后一起输出
代换的模板
情况是这样的:我使用原来做好的模板一时,能够正常替换变量,而当我只要对模板一稍作改动,比如在html中加入空格,就不能正常替换了,提示:Template Error: loadfile: rows is not a valid handle.
Halted.
可我在模板中明明有这个rows,而且所作的改动也不至于造成这个错误,更离谱的是即使把改动恢复,也不能再正常工作了,除非用原来的模板文件备份直接覆盖掉修改后的模板文件,错的非常奇怪,我已经修改了一天了,郁闷到家,请好心的大哥大姐们帮看看吧,
我有什么说得不清楚地,或者需要知道其他情况的请说明,我的qq26463431,谢谢了
模板一:
<html>
<head>
<title></title>
</head>
<body>
<table width="400" border="1" bordercolor="#000000">
<!-- BEGIN rows -->
<tr><td>{notename}</td><td>{username}</td><td>{description}</td><td>{regtime}</td><td>{exp}</td></tr>
<!-- END rows -->
</table>
<br>{pagebar}
</body>
</html>