게시판 글에 공지 체크하면 하나만 나오게 하려면 어떻게 해야하나요? 정보
게시판 글에 공지 체크하면 하나만 나오게 하려면 어떻게 해야하나요?본문
글에 공지 체크하면 두개가생성되고,하나를 지우면 다 같이 없어지네요? 공지체크하면 하나만 나오게 하려면 어떻게 하나요?
댓글 전체
/bbs/list.php 에서 아래의 부분을
if ($sca || $stx)
{
$sql = " select distinct wr_parent from $write_table where $sql_search $sql_order limit $from_record, $board[bo_page_rows] ";
}
else
{
$sql = " select * from $write_table where wr_is_comment = 0 $sql_order limit $from_record, $board[bo_page_rows] ";
}
$result = sql_query($sql);
// 년도 2자리
$today2 = $g4[time_ymd];
$list = array();
$i = 0;
if (!$sca && !$stx)
{
$arr_notice = split("\n", trim($board[bo_notice]));
for ($k=0; $k<count($arr_notice); $k++)
{
$row = sql_fetch(" select * from $write_table where wr_id = '$arr_notice[$k]' ");
if (!$row[wr_id])
continue;
$list[$i] = get_list($row, $board, $board_skin_path, $board[bo_subject_len]);
$list[$i][is_notice] = true;
$i++;
}
}
///////////////////////////////////////////////////////////////////
아래와 같이 수정하시면 됩니다.
$list = array();
$i = 0;
if (!$sca && !$stx)
{
$arr_notice = split("\n", trim($board[bo_notice]));
for ($k=0 , $ck = count($arr_notice); $k < $ck; $k++)
{
$row = sql_fetch(" select * from $write_table where wr_id = '$arr_notice[$k]' ");
if (!$row[wr_id])
continue;
$list[$i] = get_list($row, $board, $board_skin_path, $board[bo_subject_len]);
$list[$i][is_notice] = true;
$notice_order .= " and wr_id != '$arr_notice[$k]'";
$i++;
}
}
// if(!$board[bo_1]) $notice_order = ''; //게시판 설정에서 공지 재출력 유무를 조정할 경우
if ($sca || $stx)
{
$sql = " select distinct wr_parent from $write_table where $sql_search $sql_order limit $from_record, $board[bo_page_rows] ";
}
else
{
$sql = " select * from $write_table where wr_is_comment = 0 $notice_order $sql_order limit $from_record, $board[bo_page_rows] ";
}
$result = sql_query($sql);
// 년도 2자리
$today2 = $g4[time_ymd];
활용팁에 kail님께서 올려놓으신 내용입니다.
저도 이대로 변경하니 잘 적용되더군요.
if ($sca || $stx)
{
$sql = " select distinct wr_parent from $write_table where $sql_search $sql_order limit $from_record, $board[bo_page_rows] ";
}
else
{
$sql = " select * from $write_table where wr_is_comment = 0 $sql_order limit $from_record, $board[bo_page_rows] ";
}
$result = sql_query($sql);
// 년도 2자리
$today2 = $g4[time_ymd];
$list = array();
$i = 0;
if (!$sca && !$stx)
{
$arr_notice = split("\n", trim($board[bo_notice]));
for ($k=0; $k<count($arr_notice); $k++)
{
$row = sql_fetch(" select * from $write_table where wr_id = '$arr_notice[$k]' ");
if (!$row[wr_id])
continue;
$list[$i] = get_list($row, $board, $board_skin_path, $board[bo_subject_len]);
$list[$i][is_notice] = true;
$i++;
}
}
///////////////////////////////////////////////////////////////////
아래와 같이 수정하시면 됩니다.
$list = array();
$i = 0;
if (!$sca && !$stx)
{
$arr_notice = split("\n", trim($board[bo_notice]));
for ($k=0 , $ck = count($arr_notice); $k < $ck; $k++)
{
$row = sql_fetch(" select * from $write_table where wr_id = '$arr_notice[$k]' ");
if (!$row[wr_id])
continue;
$list[$i] = get_list($row, $board, $board_skin_path, $board[bo_subject_len]);
$list[$i][is_notice] = true;
$notice_order .= " and wr_id != '$arr_notice[$k]'";
$i++;
}
}
// if(!$board[bo_1]) $notice_order = ''; //게시판 설정에서 공지 재출력 유무를 조정할 경우
if ($sca || $stx)
{
$sql = " select distinct wr_parent from $write_table where $sql_search $sql_order limit $from_record, $board[bo_page_rows] ";
}
else
{
$sql = " select * from $write_table where wr_is_comment = 0 $notice_order $sql_order limit $from_record, $board[bo_page_rows] ";
}
$result = sql_query($sql);
// 년도 2자리
$today2 = $g4[time_ymd];
활용팁에 kail님께서 올려놓으신 내용입니다.
저도 이대로 변경하니 잘 적용되더군요.
정말 감사합니다.. 잘 되네요
공지 체크 두개가 생성될때, 하나만 나오게 하는 방법