不是这样用的。include "Template/template.inc";
$t = new Template("Template");
$t->set_file("MyFileHandle","reg.htm");
$t->set_file("_top", "top.htm");
$t->set_var("top","_top");
$t->parse("MyOutput","MyFileHandle");
$t->p("MyOutput");
$t = new Template("Template");
$t->set_file("MyFileHandle","reg.htm");
$t->set_file("_top", "top.htm");
$t->set_var("top","_top");
$t->parse("MyOutput","MyFileHandle");
$t->p("MyOutput");
你这样的写法,小弟怎么无法运行。谢谢了。
根目录下面有reg.php,而
reg.htm top.htm template.inc
放在文件放在Template文件夹里面,我把那个
$t->set_file("MyFileHandle","reg.htm");
修改为$t->set_file("MyFileHandle","Template/reg.htm");
后,错误 为下
Template Error: filename: file Template/Template/reg.htm does not exist.
Halted.
$t = new Template("Template"); //新的对象,设定Template为模板根目录
$t->set_file("MyFileHandle","reg.htm"); //主模板
$t->set_file("_top", "top.htm");//头部模板
$t->parse("top","_top"); //头部分析结果赋予变量top
$t->parse("MyOutput","MyFileHandle"); //分析整个模板
$t->p("MyOutput");//输出