공지사항 쓰면 모든 게시판에서 보이게 하는 코드..
최대한 그누보드 코드를 이해하면서 다른부분은 수정 안하면서 구현하려고 해봤습니다. 아직 미숙한지라 틀린부분이나 버그 있으면 알려주시면 감사하겠습니다.
특정 게시판(보통 공지게시판이겠지요)에 공지로 글을 작성하면 다른 모든 게시판에서도 공지가 보이도록 하는 코드입니다. bbs폴더에 list.php에서 공지처리부분 바로 위에 아래 코드를 복사붙여넣기 해주시기만 하면 됩니다.
아래코드 삽입시 예를들어 notice게시판에 공지1,2를 올리고 자유게시판에 공지3,4를 올리면 자유게시판으로 갔을때 공지1,2가 제일 위에 보이고 그 아래로 공지3,4가 보이고 그 아래로 일반글이 보이게 됩니다.
[code]
// 공지 처리(추가)
$board_notice_name='notice'; // 전체 공지를 줄 게시판명 (공지게시판을 따로 두어야함..)
$board_notice=sql_fetch(" select * from `g5_board` where `bo_table`='$board_notice_name' ");
if (!$sca && !$stx && $board['bo_table']!=$board_notice_name) {
$arr_notice = explode(',', trim($board_notice['bo_notice']));
$from_notice_idx = ($page - 1) * $page_rows;
if($from_notice_idx < 0)
$from_notice_idx = 0;
$board_notice_count = count($arr_notice);
$total_count+=$board_notice_count;
for ($k=0; $k<$board_notice_count; $k++) {
if (trim($arr_notice[$k]) == '') continue;
$row = sql_fetch(" select * from `g5_write_".$board_notice_name."` where wr_id = '{$arr_notice[$k]}' ");
if (!$row['wr_id']) continue;
$notice_array[] = 0;
if($k < $from_notice_idx) continue;
$list[$i] = get_list($row, $board_notice, $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 (!$sca && !$stx) {
......(후략)
[/code]
특정 게시판(보통 공지게시판이겠지요)에 공지로 글을 작성하면 다른 모든 게시판에서도 공지가 보이도록 하는 코드입니다. bbs폴더에 list.php에서 공지처리부분 바로 위에 아래 코드를 복사붙여넣기 해주시기만 하면 됩니다.
아래코드 삽입시 예를들어 notice게시판에 공지1,2를 올리고 자유게시판에 공지3,4를 올리면 자유게시판으로 갔을때 공지1,2가 제일 위에 보이고 그 아래로 공지3,4가 보이고 그 아래로 일반글이 보이게 됩니다.
[code]
// 공지 처리(추가)
$board_notice_name='notice'; // 전체 공지를 줄 게시판명 (공지게시판을 따로 두어야함..)
$board_notice=sql_fetch(" select * from `g5_board` where `bo_table`='$board_notice_name' ");
if (!$sca && !$stx && $board['bo_table']!=$board_notice_name) {
$arr_notice = explode(',', trim($board_notice['bo_notice']));
$from_notice_idx = ($page - 1) * $page_rows;
if($from_notice_idx < 0)
$from_notice_idx = 0;
$board_notice_count = count($arr_notice);
$total_count+=$board_notice_count;
for ($k=0; $k<$board_notice_count; $k++) {
if (trim($arr_notice[$k]) == '') continue;
$row = sql_fetch(" select * from `g5_write_".$board_notice_name."` where wr_id = '{$arr_notice[$k]}' ");
if (!$row['wr_id']) continue;
$notice_array[] = 0;
if($k < $from_notice_idx) continue;
$list[$i] = get_list($row, $board_notice, $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 (!$sca && !$stx) {
......(후략)
[/code]
|
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기
댓글 19개
갤러리 게시판에서는 썸네일 리스트 형식으로 나타나기 때문에... 제외하는 편이 나을 것 같네요.
if (!$sca && !$stx && $board['bo_table']!=$board_notice_name && $board['bo_skin'] != 'gallery') {
게시판 생성시 TABLE 명을 notice로 만들어서 여기에서 공지로쓰는게 전체보여집니다~
정말 감사합니다
아래코드 삽입시 예를들어 notice게시판에 공지1,2를 올리고 자유게시판에 공지3,4를 올리면 자유게시판으로 갔을때 공지1,2가 제일 위에 보이고 그 아래로 공지3,4가 보이고 그 아래로 일반글이 보이게 됩니다.
// 공지 처리(추가)
$board_notice_name='notice'; // 전체 공지를 줄 게시판명 (공지게시판을 따로 두어야함..)
$board_notice=sql_fetch(" select * from `g5_board` where `bo_table`='$board_notice_name' ");
if (!$sca && !$stx && $board['bo_table']!=$board_notice_name) {
$arr_notice = explode(',', trim($board_notice['bo_notice']));
$from_notice_idx = ($page - 1) * $page_rows;
if($from_notice_idx < 0)
$from_notice_idx = 0;
$board_notice_count = count($arr_notice);
$total_count+=$board_notice_count;
for ($k=0; $k<$board_notice_count; $k++) {
if (trim($arr_notice[$k]) == '') continue;
$row = sql_fetch(" select * from `g5_write_".$board_notice_name."` where wr_id = '{$arr_notice[$k]}' ");
if (!$row['wr_id']) continue;
$notice_array[] = 0;
if($k < $from_notice_idx) continue;
$list[$i] = get_list($row, $board_notice, $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 (!$sca && !$stx) {
......(후략)
[http://sir.kr/data/editor/2205/7e15f4a944bbbf5854dd21c713a75779_1653970902_3365.jpg]