Exemple #1
0
for ($i = 1; $i <= 2; $i++) {
    $boards = findListBoard($i);
    $table_html = "";
    $parentBoard = $boards[$i]["parentBoard"];
    $table_html .= <<<HTML_TABLE
\t\t\t\t\t\t<tr class="tr3">
\t\t\t\t\t\t\t<td colspan="4">{$parentBoard}</td>
\t\t\t\t\t\t</tr>
HTML_TABLE;
    //print_r($boards);
    //取二级版块
    for ($j = 0; $j < count($boards); $j++) {
        $boardId = $boards[$j]["boardId"];
        $boardName = $boards[$j]["boardName"];
        //echo $boardId;
        $count = findCountTopic($boardId);
        $topic = findLastTopic($boardId);
        //print_r($topic);
        $user_name = $topic["uName"];
        $publishTime = $topic["publishTime"];
        $title = $topic["title"];
        $topicId = $topic["topicId"];
        //显示二级版块
        $table_html .= <<<HTML_TABLE
\t\t\t\t\t\t<tr class="tr3">
\t\t\t\t\t\t\t<td width="5%">
\t\t\t\t\t\t\t\t&nbsp;
\t\t\t\t\t\t\t</td>
\t\t\t\t\t\t\t<th align="left">
\t\t\t\t\t\t\t\t<img src="image/board.gif">
\t\t\t\t\t\t\t\t<a href="list.php?boardId={$boardId} & currentPage=0">{$boardName}</a>
Exemple #2
0
    if (count($curBoard) >= 0) {
        $boardName = $curBoard["boardName"];
    } else {
        $msg = "版块不存在";
    }
} else {
    $msg = "版块编号不存在";
}
if ($msg != "") {
    header("location: ../error.php?msg={$msg}");
    //转入出错页面
}
// 分页所需变量
$topicList = findListTopic($curPage + 1, $boardId);
//分页取指定版块帖子列表
$topicNums = findCountTopic($boardId);
//统计版块帖子数
$pageSize = $GLOBALS["cfg"]["server"]["page_size"];
//页面容量
//print_r($topicList);
//print_r($curBoard);
//echo $topicNums;
//echo $pageSize;
//计算总页数
if ($topicNums % $pageSize == 0) {
    $pages = $topicNums / $pageSize;
} else {
    $pages = (int) ($topicNums / $pageSize) + 1;
}
//$pages = $topicNums % $pageSize == 0 ? $topicNums/$pageSize : (int)($topicNums/$pageSize)+1;
//echo $pages;