최근게시물 순서변경

최근게시물을 이용하여 제품리스트를 보여주고자 합니다.
이때 먼저 등록한 제품이 제일 상단에 보여지고 나중에 등록한 제품이 제일 아래부분에 보여지도록 하고싶습니다.
최근게시물은 기본적으로 최근에 작성한 글이 상단에 보여지므로 이 순서를 변경하는 방법을 몇일전에 여쭤보았고 운이님께서 적당한 답을 주셨습니다.
헌데 제가 사용하는 최근게시물 스킨은 겔러리 형식의 최근게시물이다보니 먼저번에 운이님이 알려주신 답변이 적용되지 않아서 소스를 올려보겠습니다.
 
허접한 질문이더라도 이해해 주시고 도와주세요~~
 
=====  먼저번 운이님께서 알려주신 답변 =============================
 

latest 스킨의 내용중

<? for ($i=0; $i<count($list); $i++) { ?> 이부분을 찾아

<? for ($i=count($list)-1; $i>=0; $i--) { ?> 로 바꿔주면 됩니다.
 
 
==============  소스 ==============================================
 
<?
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
list($height, $row_cnt) = explode(",", $options);
$all_cnt = 0;
?>
<!-- <?=$board[bo_subject]?> (<?=$board[bo_table]?>) 최신글 -->
<table width='95%'>
   <? for ($k=0; $k<$row_cnt; $k++ ) { ?>
<tr>
<?
for ($i=0; $i<count($list)/$row_cnt; $i++)
{
    if ($i > 0)
        echo '<td width=20>&nbsp;</td>';
     $title = get_text($list[$all_cnt][wr_subject]);
    $content = cut_str(get_text($list[$all_cnt][wr_content]), 80);
    $img = "$g4[path]/data/file/$bo_table/".urlencode($list[$all_cnt][file][0][file]);
    if (!file_exists($img) || !$list[$all_cnt][file][0][file])
        $img = "$latest_skin_path/img/no_image.gif";
    $href = "$g4[bbs_path]/board.php?bo_table=$bo_table";
    
    echo <<<HEREDOC
    <td width='<?=$subject_len?>' valign='top'>
        <table width='<?=$subject_len?>' border='0' cellpadding='0' cellspacing='0'>
 <tr>
            <td width='<?=$subject_len?>' height='5'></td>
 </tr>
        <tr>
            <td width='<?=$subject_len?>' height='<?=$height?>'>
  <div style='width:<?=$subject_len?>px;height:<?=$height?>px;border:1px solid #CCCCCC;padding:3px'>
  <a href='$g4[bbs_path]/board.php?bo_table=$bo_table&wr_id={$list[$all_cnt][wr_id]}'><img src='{$img}' width='$subject_len' height='$height' border='0' align='absmiddle' title='$title'></a>
  </div>
     </td>
  
  <td width='<?=$subject_len?>' height='5'></td>
  <td width='<?=$subject_len?>' height='20'>&nbsp;&nbsp;<a href='$g4[bbs_path]/board.php?bo_table=$bo_table&wr_id={$list[$all_cnt][wr_id]}&sst=wr_datetime&sod=asc'>{$list[$all_cnt][subject]}</a></td>
        </tr>

 </table>
    </td>
HEREDOC;
$all_cnt++;
   
}
?>
</tr>
<? } ?>
<? if (count($list) == 0) { ?>
<tr><td colspan=2 align='center' height=25>게시물이 없습니다.</td></tr>
<? } ?>
</table>
|

댓글 2개

for ($i=0; $i<count($list)/$row_cnt; $i++) 이부분을

for ($i=count($list)/$row_cnt;$i>=0; $i--) 로 하고

$all_cnt를 모두 $i 로 변경하세요

그럼 될겁니다.
몇일째 해봤는데 잘 안되네요 제가 많이 무식한것 같네요
댓글을 작성하시려면 로그인이 필요합니다. 로그인

그누4 질문답변

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

+
제목 글쓴이 날짜 조회
18년 전 조회 2,338
18년 전 조회 1,504
18년 전 조회 1,662
18년 전 조회 2,040
18년 전 조회 1,540
18년 전 조회 1,233
18년 전 조회 1,560
18년 전 조회 1,689
18년 전 조회 1,528
18년 전 조회 1,721
18년 전 조회 1,533
18년 전 조회 1,513
18년 전 조회 1,573
18년 전 조회 1,644
18년 전 조회 1,666
18년 전 조회 1,642
18년 전 조회 1,664
18년 전 조회 1,529
18년 전 조회 1,523
18년 전 조회 1,705
🐛 버그신고