답변 2개
채택된 답변
+20 포인트
5년 전
bbs/list.php 에서
</p>
<p>if (!$is_search_bbs) {
$arr_notice = explode(',', trim($board['bo_notice']));
$from_notice_idx = ($page - 1) * $page_rows;
if($from_notice_idx < 0)
$from_notice_idx = 0;
$board_notice_count = count($arr_notice);</p>
<p> for ($k=0; $k<$board_notice_count; $k++) {
if (trim($arr_notice[$k]) == '') continue;</p>
<p> $row = sql_fetch(" select * from {$write_table} where wr_id = '{$arr_notice[$k]}' ");</p>
<p> if (!$row['wr_id']) continue;</p>
<p> $notice_array[] = $row['wr_id'];</p>
<p> if($k < $from_notice_idx) continue;</p>
<p> $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;</p>
<p> $i++;
$notice_count++;</p>
<p> if($notice_count >= $list_page_rows)
break;
}
}</p>
<p>
주석처리 하세요
</p>
<p>if(!empty($notice_array)) {
$from_record -= count($notice_array);</p>
<p> if($from_record < 0)
$from_record = 0;</p>
<p> if($notice_count > 0)
$page_rows -= $notice_count;</p>
<p> if($page_rows < 0)
$page_rows = $list_page_rows;
}</p>
<p>
여기도 주석처리하세요
</p>
<p>if ($is_search_bbs) {
$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 ";
}</p>
<p>
if(!empty($notice_array))
$sql .= " and wr_id not in (".implode(', ', $notice_array).") ";
부분도 주석처리하세요
그럼 공지사항이 상단으로 올라가지 않을겁니다.
그리고 난후에
</p>
<p> while ($row = sql_fetch_array($result))
{
// 검색일 경우 wr_id만 얻었으므로 다시 한행을 얻는다
if ($is_search_bbs)
$row = sql_fetch(" select * from {$write_table} where wr_id = '{$row['wr_parent']}' ");</p>
<p> $list[$i] = get_list($row, $board, $board_skin_url, G5_IS_MOBILE ? $board['bo_mobile_subject_len'] : $board['bo_subject_len']);
if (strstr($sfl, 'subject')) {
$list[$i]['subject'] = search_font($stx, $list[$i]['subject']);
}
$list[$i]['is_notice'] = false;
$list_num = $total_count - ($page - 1) * $list_page_rows - $notice_count;
$list[$i]['num'] = $list_num - $k;</p>
<p> $i++;
$k++;
}</p>
<p>
이부분을
</p>
<p>if($page_rows > 0) {
$result = sql_query($sql);</p>
<p> $k = 0;</p>
<p> while ($row = sql_fetch_array($result))
{
// 검색일 경우 wr_id만 얻었으므로 다시 한행을 얻는다
if ($is_search_bbs)
$row = sql_fetch(" select * from {$write_table} where wr_id = '{$row['wr_parent']}' ");</p>
<p> $list[$i] = get_list($row, $board, $board_skin_url, G5_IS_MOBILE ? $board['bo_mobile_subject_len'] : $board['bo_subject_len']);
if (strstr($sfl, 'subject')) {
$list[$i]['subject'] = search_font($stx, $list[$i]['subject']);
}
$list[$i]['is_notice'] = false;
$arr_notice = explode(',', trim($board['bo_notice']));
for ($z=0;$z <= count($arr_notice);$z++){
if ($list[$i]['wr_id'] == $arr_notice[$z]) $list[$i]['is_notice'] = true;
}
$list_num = $total_count - ($page - 1) * $list_page_rows - $notice_count;
$list[$i]['num'] = $list_num - $k;</p>
<p> $i++;
$k++;
}
}</p>
<p>
로 공지글번호들만 is_notice true가 되도록 추가해주세요
그럼 리스트에서 상단으로 올라가지 않고 is_notice값은 가질수 있을겁니다.
완벽한 부분은 아니고 공지관련 눈에 띄는 부분만 수정한거라서
원하시는 모양이 나오는건 확인했는데 예상치못한 버그가 있을수 있습니다.
로그인 후 평가할 수 있습니다
답변에 대한 댓글 1개
�
정새싹
5년 전
댓글을 작성하려면 로그인이 필요합니다.
답변을 작성하려면 로그인이 필요합니다.
로그인
한가지만 더 여쭙고싶은데, 작성해주신 답변대로 적용해보니 제품카테고리 전체보기에서는 방금등록한 제품이 보이지 않고있습니다. 해당 분류로 들어가야 방금등록한 제품이 맨앞에 있던에.. 이부분은 어떻게 수정하는것이 좋을까요?