$conn = @mysql_connect(localhost:3306,test,test); include_once "js.class.php"; include_once "pager.class.php"; include_once "whxbb.class.php"; include_once "whxbb_article.class.php"; // 以上代碼最好全放在一個包含文件中 /* 分頁顯示文章列表,每頁10條 */ $article = new WHXBB_Article(); $info = $article->GetNInfo(10, $page); $pager = $article->pager; if (WHXBB::isError($info)) new WHXBB_Error("讀取文章信息失敗,請您稍後再試", 1, WHXBB_ERROR_ECHO); else if($info == 0) new WHXBB_Error("沒有任何您需要的信息", 2, WHXBB_ERROR_ECHO); else { for ($i = 0; $i < count($info); $i++) { $arr = $info[$i]; ?>
">=$arr[title]?> - 作者: =$arr[author]?>
} } if (WHXBB::isPager($pager)) { echo " 共" . $pager->infoCount . "條紀錄 "; echo " 共" . $pager->pageCount . "頁 "; echo " 當前頁:" . $pager->pageNo; if ($pager->pageNo != 1) echo " 首頁 "; if ($pager->GotoPrevPage()) echo " prevPageNo . ">上一頁 "; if ($pager->GotoNextPage()) echo " nextPageNo . ">下一頁 "; if ($pager->pageNo != $pager->pageCount) echo " pageCount . ">末頁 "; } @mysql_close($conn); ?>