게시판 카테고리 문의드립니다.

매출이 오르면 내리는 수수료! 지금 수수료센터에서 전자결제(PG)수수료 비교견적 신청해 보세요!
게시판 카테고리 문의드립니다.

QA

게시판 카테고리 문의드립니다.

본문

분류 선택시 공지사항을 상단에 노출하고싶어서

http://gnuwiz.com/board_tip/43 

위 설명처럼 소스를 수정했는데요

수정하고 보니까


공지글이 맨 상단에 올라오고 그 밑에 또 공지글이 나오는데

밑에 공지글은 없애고 상단 공지글만 나오게 하려면 어떻게해야하나요?


27fcec5ea711ab7a44f8147d068cc504_1505656865_4471.jpg
 

이 질문에 댓글 쓰기 :

답변 2

1) http://gnuwiz.com/board_tip/43 페이지 소스의, 

else if 부분에서, 다음과 같이 코드를 조금 더 추가해 줍니다.

* $notice_array[] = $row['wr_id'];

* $notice_count++;


} else if ($sca && !$stx) {
    $arr_notice = explode(',', trim($board['bo_notice']));
    for ($k=0; $k<count($arr_notice); $k++) {
        if (trim($arr_notice[$k])=='') continue;

        $row = sql_fetch(" select * from {$write_table} where wr_id = '{$arr_notice[$k]}' and ca_name = '{$sca}' ");

        if (!$row['wr_id']) continue;
        $notice_array[] = $row['wr_id'];

        $list[$i] = get_list($row, $board, $board_skin_url, G5_IS_MOBILE ? $board['bo_mobile_subject_len'] : $board['bo_subject_len']);
        $list[$i]['is_notice'] = true;

        $i++;
        $notice_count++;
    }
}    


2) 

조금 더 아랫쪽에,

if ($sca || $stx) {

    $sql = " select distinct wr_parent from {$write_table} where {$sql_search} {$sql_order} limit {$from_record}, $page_rows ";

} else {

    $sql = " select * from {$write_table} where wr_is_comment = 0 ";

    if(!empty($notice_array))

        $sql .= " and wr_id not in (".implode(', ', $notice_array).") ";

    $sql .= " {$sql_order} limit {$from_record}, $page_rows ";

}

부분의 소스를 다음과 같이 수정해 주면 됩니다.

(if 문의 조건 수정 및 else if 문 추가)


if ($stx) { 
    $sql = " select distinct wr_parent from {$write_table} where {$sql_search} {$sql_order} limit {$from_record}, $page_rows ";
} else if ($sca && !$stx) {
		$sql = " select * from {$write_table} where wr_is_comment = 0 and ca_name = '{$sca}' ";
    if(!empty($notice_array))
        $sql .= " and wr_id not in (".implode(', ', $notice_array).") ";
    $sql .= " {$sql_order} limit {$from_record}, $page_rows ";
} else {
    $sql = " select * from {$write_table} where wr_is_comment = 0 ";
    if(!empty($notice_array))
        $sql .= " and wr_id not in (".implode(', ', $notice_array).") ";
    $sql .= " {$sql_order} limit {$from_record}, $page_rows ";
}
답변을 작성하시기 전에 로그인 해주세요.
전체 60,147
QA 내용 검색

회원로그인

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