这是一段论坛回帖列表代码
显示出来大概是这样的
2楼 xxxx
3楼 XXX
4楼 Xxxxxx
1 2 3 4 下页我现在想把他们倒过来变成4楼 xxxx
3楼 XXX
2楼 Xxxxxx
1 2 3 4 下页怎么办呢??elseif($do == 'replylist') { echo "<br />$lang[thread_replylist]<br /><a href=\"index.php?action=thread&tid=$thread[tid]\">$thread[subject]</a>($thread[replies])<br />--------------";
$wapppp = 10;
$page = max(1, intval($page));
$start_limit = $number = ($page - 1) * $wapppp;
if($page < 2) {
$end_limit = $wapppp + 1;
} else {
$start_limit = $start_limit + 1;
$end_limit = $wapppp;
}
$query = $db->query("SELECT * FROM {$tablepre}posts
WHERE tid='$tid' AND invisible='0'
ORDER BY dateline LIMIT $start_limit, $end_limit");
while($post = $db->fetch_array($query)) {
if(!$post['first']) {
$postlist[] = $post;
}
}
if(!empty($postlist)) {
$number = ($page - 1) * $wapppp + 1;
foreach($postlist as $post) {
$waptlength = 50; echo "<br /><a href=\"index.php?action=thread&do=reply&tid=$post[tid]&pid=$post[pid]\">".++$numbe+10*$page.$lang['floor']."</a>|".($post['authorid'] ? "<a href=\"index.php?action=my&uid=$post[authorid]\">".$post['author']."</a> " : $lang['anonymous'].' ').gmdate("m-d H:i", $post['dateline'] + $timeoffset * 3600);
$needhiddenreply = ($hiddenreplies && $discuz_uid != $post['authorid'] && $discuz_uid != $thread['authorid'] && !$post['first'] && !$forum['ismoderator']);
if($needhiddenreply) {
echo "<br />".$lang['message_ishidden_hiddenreplies'];
} else {
echo "<br />".wapcutstr(trim($post['message']), $waptlength);
} }
echo "<br />".wapmulti($thread['replies'], $wapppp, $page, "index.php?action=thread&do=replylist&tid=$thread[tid]")."<br />";
}
显示出来大概是这样的
2楼 xxxx
3楼 XXX
4楼 Xxxxxx
1 2 3 4 下页我现在想把他们倒过来变成4楼 xxxx
3楼 XXX
2楼 Xxxxxx
1 2 3 4 下页怎么办呢??elseif($do == 'replylist') { echo "<br />$lang[thread_replylist]<br /><a href=\"index.php?action=thread&tid=$thread[tid]\">$thread[subject]</a>($thread[replies])<br />--------------";
$wapppp = 10;
$page = max(1, intval($page));
$start_limit = $number = ($page - 1) * $wapppp;
if($page < 2) {
$end_limit = $wapppp + 1;
} else {
$start_limit = $start_limit + 1;
$end_limit = $wapppp;
}
$query = $db->query("SELECT * FROM {$tablepre}posts
WHERE tid='$tid' AND invisible='0'
ORDER BY dateline LIMIT $start_limit, $end_limit");
while($post = $db->fetch_array($query)) {
if(!$post['first']) {
$postlist[] = $post;
}
}
if(!empty($postlist)) {
$number = ($page - 1) * $wapppp + 1;
foreach($postlist as $post) {
$waptlength = 50; echo "<br /><a href=\"index.php?action=thread&do=reply&tid=$post[tid]&pid=$post[pid]\">".++$numbe+10*$page.$lang['floor']."</a>|".($post['authorid'] ? "<a href=\"index.php?action=my&uid=$post[authorid]\">".$post['author']."</a> " : $lang['anonymous'].' ').gmdate("m-d H:i", $post['dateline'] + $timeoffset * 3600);
$needhiddenreply = ($hiddenreplies && $discuz_uid != $post['authorid'] && $discuz_uid != $thread['authorid'] && !$post['first'] && !$forum['ismoderator']);
if($needhiddenreply) {
echo "<br />".$lang['message_ishidden_hiddenreplies'];
} else {
echo "<br />".wapcutstr(trim($post['message']), $waptlength);
} }
echo "<br />".wapmulti($thread['replies'], $wapppp, $page, "index.php?action=thread&do=replylist&tid=$thread[tid]")."<br />";
}
WHERE tid='$tid' AND invisible='0'
ORDER BY dateline DESC LIMIT $start_limit, $end_limit");
floor = 总记录数 - (当前页码 - 1) * 每页显示的记录数;//第几楼for($i = 0; ....){
......
currentfloor = floor --;
......
}
顺序:
floor = (当前页码 - 1) * 每页显示的记录数;
for($i = 0; ....){
......
currentfloor = floor ++;
......
}
$wapppp = 10;
$page = max(1, intval($page));
$start_limit = $number = ($page - 1) * $wapppp;
if($page < 2) {
$end_limit = $wapppp + 1;
} else {
$start_limit = $start_limit + 1;
$end_limit = $wapppp;
}
$query = $db->query("SELECT * FROM {$tablepre}posts
WHERE tid='$tid' AND invisible='0'
ORDER BY dateline LIMIT $start_limit, $end_limit");
while($post = $db->fetch_array($query)) {
if(!$post['first']) {
$postlist[] = $post;
}
}
if(!empty($postlist)) {
//$number = ($page - 1) * $wapppp + 1;
$number = count($postlist[]) - ($page - 1) * $wapppp;
foreach($postlist as $post) {
$waptlength = 50;echo "<br /><a href=\"index.php?action=thread&do=reply&tid=$post[tid]&pid=$post[pid]\">".$number--.$lang['floor']."</a>|".($post['authorid'] ? "<a href=\"index.php?action=my&uid=$post[authorid]\">".$post['author']."</a> " : $lang['anonymous'].' ').gmdate("m-d H:i", $post['dateline'] + $timeoffset * 3600);
$needhiddenreply = ($hiddenreplies && $discuz_uid != $post['authorid'] && $discuz_uid != $thread['authorid'] && !$post['first'] && !$forum['ismoderator']);
if($needhiddenreply) {
echo "<br />".$lang['message_ishidden_hiddenreplies'];
} else {
echo "<br />".wapcutstr(trim($post['message']), $waptlength);
}}
echo "<br />".wapmulti($thread['replies'], $wapppp, $page, "index.php?action=thread&do=replylist&tid=$thread[tid]")."<br />";
}