dzy
(dzy)
注册会员

一般会员
UID 64807
精华
0
积分 83
帖子 74
金钱 83 喜悦币
威望 0
人脉 0
阅读权限 20
注册 2005-6-17
状态 离线
|
[广告]: 代充Paypal帐号美元
smarttemplate模板问题!
ndex.php
<?php
require_once "smart/class.smarttemplate.php";
require_once "mysql.php";
$classId=$_GET["classId"];
$sql="select id,classname from newsclass order by id desc";
$res=@mysql_query($sql);
if(!$res)
{
echo "sql语句有错错误信息如示:<br>".mysql_error();
exit;
}
$tp=new SmartTemplate('index.tpl');
$path=$_SERVER['DOCUMENT_ROOT'];
$tp->template_dir='tpl/';
$tp->temp_dir=$path.'phpnews/compiled';
$tp->cahe_dir=$path.'phpnews/file/';
$tp->cahe_leftime=120;
$webtitle='dzy news center';
$arr = array();
while($rs=mysql_fetch_row($res))
{
$arr[]=array(
array(
'Id' => $rs[0],
'ClassName' => $rs[1],
)
);
}
$tp->assign('title',$webtitle);
$tp->assign('classname',$arr);
$tp->output();
?>
index.tpl
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>{title}</title>
<style type="text/css">
<!--
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
-->
</style></head>
<body>
<table width="750" border="0" align="center" cellpadding="0" cellspacing="1">
<tr>
<td><table width="100%" border="0" cellspacing="1" cellpadding="0">
<tr>
<!---BEGIN classname--->
<td width="10%"><div align="center"><a href="index.php?classId={Id}">{ClassName}</a></div></td>
<!---END classname--->
</tr>
</table></td>
</tr>
</table>
</body>
</html>
就是替换不了!
我刚接触模板引擎
|
|