这里有几篇关于模板的文章
我用的是phplib模板
下面是其中几个函数的使用
$T->Set_File("随便定义","模板文件.tpl");
$T->Set_Block("在set_file中定义的","<!-- 来自模板 -->","随便定义");
$T->Parse("在Set_Block中定义的","<!-- 来自模板 -->",true);
$T->Parse("随便输出结果","在Set_File中定义的");
设置循环格式为:
<!--(多于一个空格) BEGIN $handle(多于一个空格)-->
如何将模板生成静态网页
PHP代码
<?php
//这里使用phplib模板
............
............
$tpl->parse("output","html");
$output = $tpl->get("output");// $output 为整个网页内容
function wfile($file,$content,$mode='w') {
$oldmask = umask(0);
$fp = fopen($file, $mode);
if (!$fp) return false;
fwrite($fp,$content);
fclose($fp);
umask($oldmask);
return true;
}
// 写到文件里
Wfile($FILE,$output);
header("location:$FILE");//重定向到生成的网页
}
?>


