<code><?<br />$conn = @mysql_connect('localhost:3306','test','test');<br />include_once "js.class.php";<br />include_once "pager.class.php";<br />include_once "whxbb.class.php";<br />include_once "whxbb_article.class.php";<br />// 以上代码最好全放在一个包含文件中<br /><?<br />/* 分页显示文章列表,每页10条 */<br />$article = new WHXBB_Article();<br />$info = $article->GetNInfo(10, $page);<br />$pager = $article->pager;<br />if (WHXBB::isError($info))<br />
new WHXBB_Error("读取文章信息失败,请您稍后再试", 1, WHXBB_ERROR_ECHO);<br />else if($info == 0)<br />
new WHXBB_Error("没有任何您需要的信息", 2, WHXBB_ERROR_ECHO);<br />else<br />{<br />
for ($i = 0; $i < count($info); $i++)<br />
{<br />
$arr = $info[$i];<br />?><br /> <p><a href="read.php?id=<?=$arr['id']?>"><?=$arr['title']?></a> - 作者: <?=$arr['author']?></p><br /><?<br />
}<br />}<br />if (WHXBB::isPager($pager))<br />{<br />echo " 共" . $pager->infoCount . "条纪录 ";<br />echo " 共" . $pager->pageCount . "页 ";<br />echo " 当前页:" . $pager->pageNo;<br />if ($pager->pageNo != 1)<br />  echo " <a href=list.php?page=1>首页</a> ";<br />if ($pager->GotoPrevPage())<br />  echo " <a href=list.php?page=" . $pager->prevPageNo . ">上一页</a> ";<br />if ($pager->GotoNextPage())<br />  echo " <a href=list.php?page=" . $pager->nextPageNo . ">下一页</a> ";<br />if ($pager->pageNo != $pager->pageCount)<br />  echo " <a href=list.php?page=" . $pager->pageCount . ">末页</a> ";<br />}<br />@mysql_close($conn);<br />?></code>