不是这样用的。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");

解决方案 »

  1.   

    ccterran(iwind) 
    你这样的写法,小弟怎么无法运行。谢谢了。
      

  2.   

    大哥,小弟先说一下各个文件 的位置
    根目录下面有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.
      

  3.   

    干吗要修改成$t->set_file("MyFileHandle","Template/reg.htm");?刚才我也写错了,应该是include "Template/template.inc"; //引用文件
    $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");//输出