게시판 글번호 역순

게시판 글번호 역순

QA

게시판 글번호 역순

본문

<?php
for ($i=0; $i<count($list); $i++) {
?>
 
-----------------------------------------
 
<td class="hidden-xs"><?php echo $i+1 ?></td> 

 

이렇게만 올려도 될런지 모르겠는데...;;

 

지금은 게시판글번호가

1

2

3

4

이런식으로 나오구요..

 

제가 원하는건 쓸때마다 번호가 위로 올라가게

 

4

3

2

1

이런식으로 하고싶은데.. 모르겠네요 도와주세요..ㅠ

이 질문에 댓글 쓰기 :

답변 2

<td class="hidden-xs"><?php echo $i+1 ?></td>


=> 아래와 같이 하시면 될거 같습니다.


<td class="hidden-xs"><?php echo count($list) - 1 ?></td>

<?php echo $list[$i]['num']; ?>

 

이미 계산된 값이 있습니다. 

/bbs/list.php 중./..
    while ($row = sql_fetch_array($result))
    {
        // 검색일 경우 wr_id만 얻었으므로 다시 한행을 얻는다
        if ($sca || $stx)
            $row = sql_fetch(" select * from {$write_table} where wr_id = '{$row['wr_parent']}' ");

        $list[$i] = get_list($row, $board, $board_skin_url, G5_IS_MOBILE ? $board['bo_mobile_subject_len'] : $board['bo_subject_len']);
        if (strstr($sfl, 'subject')) {
            $list[$i]['subject'] = search_font($stx, $list[$i]['subject']);
        }
        $list[$i]['is_notice'] = false;
        $list_num = $total_count - ($page - 1) * $list_page_rows - $notice_count;
        $list[$i]['num'] = $list_num - $k;

        $i++;
        $k++;
    }

전체 게시물 수 에서 순차적으로 1씩 빼면서 $list 안에 푸쉬합니다.

답변을 작성하시기 전에 로그인 해주세요.
전체 1,267
QA 내용 검색

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1404호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT