최근게시물 순서변경 > 그누4 질문답변

그누4 질문답변

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

최근게시물 순서변경 정보

최근게시물 순서변경

본문

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

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> </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'>  <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>

댓글 전체

전체 66,554 |RSS
그누4 질문답변 내용 검색

회원로그인

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