게시판 다음페이지에도 공지가 보이게하는방법..??
본문
<!--공지 사항-->
<?php
for($j=0; $j<count($notice_array); $j++){
?>
<tr class="notice">
<tr class="<?php if ($list[$j]['is_notice']) echo "bo_notice"; ?>">
...
<?php } ?>
...
<!--일반 게시글-->
<?php
for ($i=0; $i<count($list); $i++) {
if($i>0 && ($i % $bo_gallery_cols == 0))
$style = 'clear:both;';
else
$style = '';
if ($i == 0) $k = 0;
$k += 1;
if ($k % $bo_gallery_cols == 0) $style .= "margin:0 !important;";
?>
...
<?php } ?>
한 게시판에 윗부분은 공지글만, 아랫부분은 일반 게시글만 보이게 하였는데요
다음 페이지로 넘어가면 공지가 안보이고 일반게시글이 보여서 그러는데..
다음 페이지에서도 공지가 그대로 표시되게 할수 있을까요..??
!-->답변 1
bbs > list.php 을 수정해서 아래와 같이 해주세요.
// 공지 처리
if (!$sca && !$stx) {
$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);
for ($k=0; $k<$board_notice_count; $k++) {
if (trim($arr_notice[$k]) == '') continue;
$row = sql_fetch(" select * from {$write_table} where wr_id = '{$arr_notice[$k]}' ");
if (!$row['wr_id']) continue;
$notice_array[] = $row['wr_id'];
// if($k < $from_notice_idx) continue;
$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++;
if($notice_count >= $list_page_rows)
break;
}
}
위의 부분을 찾아서 if($k < $from_notice_idx) continue; 와 $notice_count++; 을 주석처리해주세요.