注册 登录
编程论坛 PHP技术论坛

我写的第一个引用模板的PHP文件

guaishi 发布于 2008-03-29 14:18, 1722 次点击
1.htm
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>测验</title>
</head>
你好吗?{fg}<br>
<body>
这是我写的第一个用模板程式:{dg}
</body>
</html>
1.php
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>怪石网络</title>
</head>
<?php  include ('zh/lib/template.php');
 ?>
 <?php
$con=new Template();
$con->set_file("main","1.htm");
$con->set_var("fg","helloworld");
$df="你非常强这么快就学会了";
$con->set_var("dg",$df);
$con->parse("mains","main");
$con->p("mains");


  ?>
<body>

</body>
</html>
3 回复
#2
kai2008-03-31 05:16
你的问题在哪里啊?你的那个1.htm 文件没用,就那个1.php 就可以了。
#3
guaishi2008-03-31 10:12
这个程式可以运行就是不理解
$con->set_file("main","1.htm");
$con->set_var("fg","helloworld");
$df="你非常强这么快就学会了";
$con->set_var("dg",$df);
$con->parse("mains","main");
$con->p("mains");
这几句话的意思
#4
lmhllr2008-03-31 12:49
回复 3# 的帖子
Template模版语法
1