게시판 카테고리 문의드립니다. 채택완료
분류 선택시 공지사항을 상단에 노출하고싶어서
http://gnuwiz.com/board_tip/43">http://gnuwiz.com/board_tip/43
위 설명처럼 소스를 수정했는데요
수정하고 보니까
공지글이 맨 상단에 올라오고 그 밑에 또 공지글이 나오는데
밑에 공지글은 없애고 상단 공지글만 나오게 하려면 어떻게해야하나요?

답변 2개
1) http://gnuwiz.com/board_tip/43" style="font-size: 14.6667px;">http://gnuwiz.com/board_tip/43 페이지 소스의,
else if 부분에서, 다음과 같이 코드를 조금 더 추가해 줍니다.
* $notice_array[] = $row['wr_id'];
* $notice_count++;
</p><p>} else if ($sca && !$stx) {</p><p> $arr_notice = explode(',', trim($board['bo_notice']));</p><p> for ($k=0; $k<count($arr_notice); $k++) {</p><p> if (trim($arr_notice[$k])=='') continue;</p><p>
</p><p> $row = sql_fetch(" select * from {$write_table} where wr_id = '{$arr_notice[$k]}' and ca_name = '{$sca}' ");</p><p>
</p><p> if (!$row['wr_id']) continue;</p><p> $notice_array[] = $row['wr_id'];</p><p>
</p><p> $list[$i] = get_list($row, $board, $board_skin_url, G5_IS_MOBILE ? $board['bo_mobile_subject_len'] : $board['bo_subject_len']);</p><p> $list[$i]['is_notice'] = true;</p><p>
</p><p> $i++;</p><p> $notice_count++;</p><p> }</p><p>} </p><p>
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 문 추가)
</p><p>if ($stx) { </p><p> $sql = " select distinct wr_parent from {$write_table} where {$sql_search} {$sql_order} limit {$from_record}, $page_rows ";</p><p>} else if ($sca && !$stx) {</p><p><span style="white-space:pre"> </span>$sql = " select * from {$write_table} where wr_is_comment = 0 and ca_name = '{$sca}' ";</p><p> if(!empty($notice_array))</p><p> $sql .= " and wr_id not in (".implode(', ', $notice_array).") ";</p><p> $sql .= " {$sql_order} limit {$from_record}, $page_rows ";</p><p>} else {</p><p> $sql = " select * from {$write_table} where wr_is_comment = 0 ";</p><p> if(!empty($notice_array))</p><p> $sql .= " and wr_id not in (".implode(', ', $notice_array).") ";</p><p> $sql .= " {$sql_order} limit {$from_record}, $page_rows ";</p><p>}</p><p>
답변에 대한 댓글 1개
댓글을 작성하려면 로그인이 필요합니다.
답변을 작성하려면 로그인이 필요합니다.
로그인