PHPLIB模板嵌套示例

| No Comments | No TrackBacks

//====================================================
// FileName:answer_list.php
// Summary: 有问必答
// Author: *kozzi
// CreateTime: 2005-7-15
// LastModifed:2005-7-15
// copyright (c)2005 kozzi.woo@gmail.com
//====================================================
$include_path = '../_inc';
include_once("$include_path/db.php");
include_once("$include_path/function.php");
include_once("$include_path/template.php");
include_once("$include_path/function_common.php");
include_once("$include_path/function_form.php");

session_start();

init("answer_list.html");
disp_msg();
initend();
// 开始业务流程
// 功能函数开始
function disp_msg() // 显示信息页面
{
include_once "../_inc/pageft.php";
global $db, $usrid, $show_id, $show_type, $mpath;
global $page, $firstcount, $pagenav, $displaypg, $_SERVER;
global $dopage;
//$dopage->set_file("Index_File", $mpath."answer_list.html");

$sql = "select * from tbl_answers where pid='0'";
$result = $db->sql_query($sql);
$total = $db->sql_numrows($result);
pageft($total, 10);
$sql = $sql . " order by id desc limit $firstcount,$displaypg";
// echo $sql;
$result = $db->sql_query($sql);
$dopage->set_block("Index_File", "ROWLIST", "RL");
$dopage->set_block("ROWLIST", "ROWREPLY", "RR");
$i = 1;
while ($row = $db->sql_fetchrow($result)) {
$parm = array(
i => $i,
ID => $row['id'],
TITLE => $row['title'],
CONTENT => $row['content'],
USRID => $row['usrid'],
ADDTIME => $row['addtime']
);
$dopage->set_var("RR");
$dopage->set_var($parm);
//留言回复
$rsql = "select * from tbl_answers where pid='".$row['id']."'";
$reply = $db->sql_query($rsql);
$j=1;
while ($rows[$i][$j] = $db->sql_fetchrow($reply)) {
$parmr = array(
j => $j,
//ID => $row['id'],
REPLYTITLE => $rows[$i][$j]['title'],
REPLYCONTENT => $rows[$i][$j]['content'],
REPLYUSER => $rows[$i][$j]['usrid'],
REPLYTIME => $rows[$i][$j]['addtime']
);
$dopage->set_var($parmr);
$dopage->parse("RR", "ROWREPLY", true);
$j=$j+1;
}
$dopage->parse("RL", "ROWLIST", true);
$i = $i + 1;
}
$pageshow = array(
pagelist => $pagenav
);
$dopage->set_var($pageshow);
}

?>

No TrackBacks

TrackBack URL: http://www.wujianrong.com/mt-tb.cgi/207

Leave a comment

About this Entry

This page contains a single entry by kevinwu published on November 14, 2005 5:09 PM.

2007年我国搜索引擎市场规模将达33亿人民币 was the previous entry in this blog.

雅虎中国为何弃门户重搜索? is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.