templatelite+adodb+mysql的一点问题
我写smarty做了一个小小模板想试一下可不可以真现在但做完后出现在问题了。
路径:
wwwroot--|
|adodb
|templates
|compiled
|cache
|config
|libs
|src
模板index.html代码:
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>
<body>
<table width="420" border="1" cellspacing="0" cellpadding="0">
<tr>
<td width="25%">id</td>
<td width="25%">name </td>
<td width="25%"></td>
<td width="25%">age</td>
<td width="25%">email</td>
</tr>
<tr>
{$list}
</tr>
</table>
</body>
</html>
模板list.html代码:
<tr>
<td>{$field[0]}</td>
<td>{$field[1]}</td>
<td>{$field[2]}</td>
<td>{$field[3]}</td>
<td>{$field[4]}</td></tr>
index.php源代码:
<?
require("adodb/adodb.inc.php");
require("libs/Smarty.class.php");
$temp=new Smarty;
$conn=&adonewconnection('mysql');
$conn->pconnect('localhost','root','system','test');
$recordset=&$conn->Execute('select * from test');
if (!$recordset){
print $conn->errormsg();
}else{
while(!($recordset->eof())){
$temp->assign("field",$recordset->fields);
$rs.=$temp->display("list.html");
$recordset->movenext();
}
}
$temp->assign("list",$rs);
$temp->display("index.html");
$recordset->close();
$conn->close();
?>
输出的时候网页不安模板的来输出。他先输出数据库里面的东西再输出index.html里的面的东。。搞到好像分开了两半一样。