최신글에서 공지를 먼저 출력하기 > 그누4 질문답변

그누4 질문답변

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

최신글에서 공지를 먼저 출력하기 정보

최신글에서 공지를 먼저 출력하기

본문

http://sir.co.kr/bbs/board.php?bo_table=g4_tiptech&wr_id=16440

latest.skin.php 첫부분에 추가하세요

 if (count($list) >1 ) {
foreach( $list as $key => $value) $tmp_notice[$key] = $value['is_notice'] *100000 + $value['wr_id'];
 array_multisort($tmp_notice, SORT_DESC, $list);
}
-------------------------------------------------------
10만을 곱해준 이유는 wr_id 값이 큰 순서로 정렬하기 위함입니다(한개 이상의 공지 및공지가 아닌 게시물들의 출력 순서 결정) -- 10 이나 100 등 아무것이나 할 수 있지만 출력할 목록수보다는 커야겠지요



-----------------
이 소스가 리스트 최신글 일 때는 잘 적용 되는데...
갤러리 최신글일 때는
적용이 안돼네요....어떻게 해야 될까요?
고수님들 부탁드립니다.
아래는 제가 사용하는

갤러리 최신글의
latest.skin.php입니다.

<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
if (count($list) >1 ) {
foreach( $list as $key => $value) $tmp_notice[$key] = $value['is_notice'] *100000 + $value['wr_id'];
 array_multisort($tmp_notice, SORT_DESC, $list);
}

?>
   

<table width=100% cellpadding=0 cellspacing=0 style="table-layout: fixed;">
<tr>
    <td align=center>
        <table width=100% border=0>
        <tr>
<?
for ($i=0; $i<count($list); $i++)
{
    if ($i > 0)
        echo '<td width=20 align=center> </td>';

     $title = get_text($list[$i][wr_ject]);
    $content = cut_str(get_text($list[$i][wr_content]), 80);
    $img = "$g4[path]/data/file/$bo_table/".urlencode($list[$i][file][0][file]);
    if (!file_exists($img) || !$list[$i][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='174' valign='top' align='center'>
        <table width='174' border='0' cellpadding='0' cellspacing='0' align='center'>
    <tr>
            <td width='174' height='5' align='center'></td>
    </tr>

        <tr>
            <td width='174' height='174' align='center'>
        <div style='width:174px;height:174px;border:0px solid #CCCCCC;padding:0px' align='center'>
        <a href='$g4[bbs_path]/board.php?bo_table=$bo_table&wr_id={$list[$i][wr_id]}'><img src='{$img}' width='174' height='174' border='0' align='absmiddle' title='$title'></a>
        </div>
        </td>
        </tr>
    </table>
    </td>
HEREDOC;
}
?>   
</tr></table>
<? if (count($list) == 0) { ?><tr><td colspan=4 align=center>게시물이 없습니다.</td></tr><? } ?>
</table>

  • 복사

댓글 전체

테스트 해보니 이상이 없습니다. 공지글이 먼저 출력이 됩니다.
적용이 안된다는 주소를 알려주시면 좀 더 알려드리기 쉬울것 같습니다.
18번째 줄은 오타인가요?

수정 전: $title = get_text($list[$i][wr_ject]);
수정 후: $title = get_text($list[$i][wr_subject]);
© SIRSOFT
현재 페이지 제일 처음으로