특정게시판만 정렬을 다르게 하고 싶을때.. > 그누3 팁자료실

그누3 팁자료실

특정게시판만 정렬을 다르게 하고 싶을때.. 정보

그누호환 특정게시판만 정렬을 다르게 하고 싶을때..

본문

gblist.php 의 아래부분에서

// 정렬
if (!$ssort) {
    $ssort  = "wr_notice, wr_num, wr_reply";
    $sorder = "";
}

아래에
아래와 같이 추가하여 사용합니다

if($bo_table==home_stay){//게시판이 홈스테이일경우
$ssort  = "wr_datetime";//정렬은  날짜순으로
    $sorder = "asc";//입력한순서부텀 desc로하면 최근 날짜순으로...
}

위와 같이 응용하여 씁니다
추천
0

댓글 전체

latest2('스킨명',게시판명,글수.제목글자수)  스키면은 또같이해도 될거 같읍니다만 안된다면 스킨명을 달리하여 올리시고 그스킨명을 ....
한게시판맘원하시면
립에서 레이티스트 함수를 복사해서

function latest2($skin_dir='', $bo_table, $rows=10, $len=40)
{
    global $latest_skin, $cfg;

    $tmp_latest_skin = $latest_skin;

    // 스킨디렉토리값이 넘어왔다면
    if ($skin_dir) {
        $latest_skin = "./bbs/skin/latest/$skin_dir";
    }

    $sql = " select * from $cfg[table_board] where bo_table = '$bo_table' ";
    $bo = sql_fetch($sql);
    $bo_subject = $bo[bo_subject];

    $sql = " select *
              from {$cfg[write_table_prefix]}{$bo_table}
              where wr_comment = 0
              order by wr_id asc limit 0, $rows ";
    $result = sql_query($sql);
    for ($i=0; $row = mysql_fetch_array($result); $i++) {
        $list[$i] = $row;

        $list[$i][href] = "./?doc=bbs/gnuboard.php&bo_table=$bo_table&wr_id=$row[wr_id]";

        // 코멘트 카운트
        $list[$i][commentcnt] = "";
        if ($row[wr_commentcnt] > 0) {
            $list[$i][commentcnt] = "($row[wr_commentcnt])";
        }

        $list[$i][name] = gblayer($row[mb_id], cut_str($row[wr_name],10), $row[wr_email], $row[wr_homepage]);
        $list[$i][subject] = conv_subject($row[wr_subject], $len,"…");
        $list[$i][content] = get_text($row[wr_content]);
        $list[$i][date] = substr($row[wr_datetime],2,8);

        $list[$i][icon_new] = "";
        if ($row[wr_datetime] >= date("Y-m-d H:i:s", time() - $bo[bo_new] * 3600)) {
            $list[$i][icon_new] = "<img src='$latest_skin/icon_new.gif' align=absmiddle> ";
        }

        for ($k=1; $k<=$cfg[file_count]; $k++) {
            if (@preg_match($cfg[image_extension], $row["wr_file".$k])) {
                $list[$i]["file_image".$k] = "./data/file/$bo_table/" . $row["wr_file".$k];
            }
        }

        for ($k=1; $k<=$cfg[link_count]; $k++) {
            if ($row["wr_link".$k]) {
                $link[$i]["link".$k] = set_http(get_text(cut_str($row["wr_link".$k], 255)));
                $link[$i]["link_href".$k] = "./?doc=bbs/gblink.php&$qstr&wr_id=$row[wr_id]&index=$k";
            }
        }
    }
    mysql_free_result($result);
   
    include "$latest_skin/latest.skin.php";

    $latest_skin = $tmp_latest_skin;
}

이렇게 투로 만든다음

보여줄곳에 latest2('',게시판명,글수.제목글자수) 해보셔요...
립에서요
$sql = " select *
              from {$cfg[write_table_prefix]}{$bo_table}
              where wr_comment = 0
              order by wr_id desc limit 0, $rows ";

order by wr_id asc limit 0, $rows ";

이렇게해보셔요...그렇지만...다른 최신글들도 함께그렇게 될거여요...
링크된 부분의 리스트는 정렬이 asc 로 되었습니다.
(이곳 만도님의 가르침대로..)
최신글의 정렬도 asc로 정렬되게 하고자 합니다.
http://www.sangdam.info/gnu3/?doc=bbs/gnuboard.php&bo_table=office

위 링크의 메뉴부분이 최신글입니다.
그것을 리스크와 같게하고자 합니다.
아래는 최신글스킨이고요....
---------------------------------
<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
?>
<table width=170 cellpadding=0 cellspacing=0 align=center border=1 bordercolordark="#ECECDC" bordercolorlight="#000000">
<tr>
<td width="100%" align="left">
<table width=100% align="left">

<tr>
    <td height=22 valign="middle">
<img src='<?=$latest_skin?>/female_n.gif' >
&nbsp;<a href='./?doc=bbs/gnuboard.php&bo_table=<?=$bo_table?>'><b><?=$bo_subject?></b></a>
</td>
</tr>
<tr>
    <td align="left">
        <table width=100% cellpadding=0 cellspacing=0 border=0 align="left">
        <? for ($i=0; $i<count($list); $i++) { ?>
        <? /* if ($i) { echo "<tr><td colspan=2 height=1 background='$latest_skin/dot_line.gif' width=7 height=7></td></tr>"; } */?>
        <tr>
<td width=15 align=center><img src='<?=$latest_skin?>/icon_li.gif'></td>
            <td width='' height=22>&nbsp;<a href='<?="./?doc=bbs/gnuboard.php&bo_table=$bo_table&wr_id={$list[$i][wr_id]}"?>'><span  style='font-size:9pt;'><?=$list[$i][subject]?> </span> <span style='font-size:8pt;'><?=$list[$i][commentcnt]?></span></a> <?=$list[$i][icon_new]?></td>
</tr>
        <? } ?>
        <? if (count($list) == 0) { echo "<tr><td colspan=2 align=center height=50>자료가 없습니다.</td></tr>"; } ?>
        </table>
</td>
</tr>

</table>
</td>
</tr>
</table>


아래는 latest.lib 입니다.
------------------------
<?
if (defined(__FILE__)) return;
define(__FILE__, TRUE);

//==============================================================================
//  최신글 관련 함수
//==============================================================================


// 최신글 추출
function latest($skin_dir='', $bo_table, $rows=10, $len=40)
{
    global $latest_skin, $cfg;

    $tmp_latest_skin = $latest_skin;

    // 스킨디렉토리값이 넘어왔다면
    if ($skin_dir) {
        $latest_skin = "./bbs/skin/latest/$skin_dir";
    }

    $sql = " select * from $cfg[table_board] where bo_table = '$bo_table' ";
    $bo = sql_fetch($sql);
    $bo_subject = $bo[bo_subject];

    $sql = " select *
              from {$cfg[write_table_prefix]}{$bo_table}
              where wr_comment = 0
              order by wr_id desc limit 0, $rows ";
    $result = sql_query($sql);
    for ($i=0; $row = mysql_fetch_array($result); $i++) {
        $list[$i] = $row;

        $list[$i][href] = "./?doc=bbs/gnuboard.php&bo_table=$bo_table&wr_id=$row[wr_id]";

        // 코멘트 카운트
        $list[$i][commentcnt] = "";
        if ($row[wr_commentcnt] > 0) {
            $list[$i][commentcnt] = "($row[wr_commentcnt])";
        }

        $list[$i][name] = gblayer($row[mb_id], cut_str($row[wr_name],10), $row[wr_email], $row[wr_homepage]);
        $list[$i][subject] = conv_subject($row[wr_subject], $len,"…");
        $list[$i][content] = get_text($row[wr_content]);
        $list[$i][date] = substr($row[wr_datetime],2,8);

        $list[$i][icon_new] = "";
        if ($row[wr_datetime] >= date("Y-m-d H:i:s", time() - $bo[bo_new] * 3600)) {
            $list[$i][icon_new] = "<img src='$latest_skin/icon_new.gif' align=absmiddle> ";
        }

        for ($k=1; $k<=$cfg[file_count]; $k++) {
            if (@preg_match($cfg[image_extension], $row["wr_file".$k])) {
                $list[$i]["file_image".$k] = "./data/file/$bo_table/" . $row["wr_file".$k];
            }
        }

        for ($k=1; $k<=$cfg[link_count]; $k++) {
            if ($row["wr_link".$k]) {
                $link[$i]["link".$k] = set_http(get_text(cut_str($row["wr_link".$k], 255)));
                $link[$i]["link_href".$k] = "./?doc=bbs/gblink.php&$qstr&wr_id=$row[wr_id]&index=$k";
            }
        }
    }
    mysql_free_result($result);
   
    include "$latest_skin/latest.skin.php";

    $latest_skin = $tmp_latest_skin;
}
?>
전체 1,026
그누3 팁자료실 내용 검색

회원로그인

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