![]() |
|
首页 │ Apache │ Linux│ Java│ MySQL│ 注册│帮助 | |||
主模版中有一模版变量{topicFrom},想用另一个模版替换以上变量。代码如下。[PHP]
$t->set_file("my_footer", "forum_test.htm");
while ($rows = mysql_fetch_array ($result))
{
$topicname= $rows["topicname"];
$topicTitle=$rows["topictitle"];
$topicid= $rows["topicid"];
$topicdate= $rows["topicdate"];
$replyname= $rows["replyname"];
$replydate= $rows["replydate"];
$textCount= $rows["browserCount"];
$replyCount=$rows["replyCount"];
$t->set_var("topicTitle", $topicTitle);
$t->set_var("topicname", $topicname);
$t->set_var("topicid", $topicid);
$t->set_var("replydate", $replydate);
$t->set_var("topicdate", $topicdate);
$t->set_var("replyname", $replyname);
$t->set_var("textcount", $textCount);
$t->set_var("hfcount", $replyCount);
$t->parse("topicFrom", "my_footer");
$t->p("out");
}
[/PHP]
但这样却只显示了第一条记录,数据库中一共有3条记录,测过循环次数是3,但只显示了第一条,不知道是咱回事了.请教大大了.

