코멘트 번호를 역순으로 작업

재가 사용하고 있는 view_comment.skin.php의 내용입니다.
자세한 것은 첨부하였구요.

-------------- 내용 시작 --------------

<? // 코멘트 번호 계산식 및 페이징 표시
$c_total_count = count($list); // 전체 코멘트 수 할당
$c_rows = 10; // 보여줄 개수

if ($c_total_count != 0){
$c_total_page = ceil($c_total_count / $c_rows); // 전체 페이지 계산

if (!$c_page) $c_page = 1; // 페이지가 없으면 첫 페이지 (1 페이지)
$c_from_record = ($c_page - 1) * $c_rows; // 시작 코멘트 구하기
$c_last_record = $c_from_record + $c_rows; // 끝 코멘트 구하기
if($c_last_record > $c_total_count){ // 마지막 코멘트가 전체 코멘트 보다 크면 전체 코멘트로 할당
$c_last_record = $c_total_count;
}
}
?>
<style type="text/css">
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
</style>


<table width="737px" border="0" align="left" cellpadding="0" cellspacing="0">
<tr><td><div style="padding:5px 0 0px 10px;"><img src="<?=$http_url?>/homeskin/review_title.gif"></div></td></tr>
<tr><td>
<table width=<?=$width?> border="0" align=center cellpadding=10 cellspacing="0" bordercolor="#EAEAEA"><tr><td>


<!-- 코멘트 리스트 -->
<table width="742px" border="1" bordercolor="#EAEAEA" cellpadding="0" cellspacing="0">
<tr valign="top"><td height="31"><div style="padding:0px 0 0px 0;"><img src="<?=$http_url?>/homeskin/comment_title.jpg"></div></td></tr>
<tr><td>

<div id="commentContents">

<? // 코멘트 표시
$i = $c_from_record;

for ($i; $i<$c_last_record; $i++) {
$comment_id = $list[$i][wr_id];
$cnt_no = $i + 1 ;
?>

<a name="c_<?=$comment_id?>"></a>
<table width="<?=$width?>" cellpadding=0 cellspacing=0 border=0 bordercolor="#EAEAEA">
<tr>
<td><? for ($k=0; $k<strlen($list[$i][wr_comment_reply]); $k++) echo "     "; ?></td>
<td width='100%'>

<table width=100% border=0 align="left" cellpadding=0 cellspacing=0>
<tr>
<td valign=top>
<table border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="43" align="center"><?=$cnt_no?> </td>
<td width="610">
<!-- 코멘트 출력 -->


-------------- 내용 끝 --------------

하여서 코멘트 출력을 하고있습니다.

이것을 역순으로 하고 싶은데요..

$cnt_no = $ttl_cnt--;

<?=$ttl_cnt--;?>

해서 하면 전체페이지가 역순이 나와도 -2씩되어서 나오고

1페이지가 20부터 나오면

2페이지도 20부터 나옵니다.

무엇이 잘못된건지 ? 혹시 알수있을까요? 열심히 배우고 있는데...

참 걸리는것이 많습니다..

도와주세요~ㅠㅠ

첨부파일

view_comment.skin.php (13.7 KB) 6회 2013-10-11 01:40
|

댓글 3개

그쪽이 아니라 bbs/view_comment.php 에서

$sql 문쪽

order by 를 찾아서 그쪽 부근을 수정해보세요

가지고 오는거는 여기서 골라서 가지고 오는거니깐

select문 order by desc 혹은 asc 이걸로 검색을 해보세요.

order by 라는 것이 쿼리문에서 정렬 시켜서 가지고 오는거니깐 그쪽을 공부해야겠네요.
$cnt_no = $c_total_count - $i;
해주신데로 해보았더니~ 바로되네요~ 완전 감사해요~*^^*
댓글을 작성하시려면 로그인이 필요합니다.

그누4 질문답변

그누보드4 관련 질문은 QA 로 이전됩니다. QA 그누보드4 바로가기 기존 게시물은 열람만 가능합니다.

+
제목 글쓴이 날짜 조회
12년 전 조회 1,596
12년 전 조회 925
12년 전 조회 1,531
12년 전 조회 1,565
12년 전 조회 1,736
12년 전 조회 1,703
12년 전 조회 1,618
12년 전 조회 1,551
12년 전 조회 2,565
12년 전 조회 1,642
12년 전 조회 797
12년 전 조회 1,026
12년 전 조회 903
12년 전 조회 1,547
12년 전 조회 1,536
12년 전 조회 1,813
12년 전 조회 1,510
12년 전 조회 1,004
12년 전 조회 1,052
12년 전 조회 975