lastest에서 공지사항을 체크하지 않은 게시물만 불러오려면? 정보
lastest에서 공지사항을 체크하지 않은 게시물만 불러오려면?
본문
안녕하세요.ㅎ
아래는 공지사항을 체크한 게시물만 불러오는 latest lib 입니다.
여기서 반대로 공지사항을 체크하지 않은 게시물만 불러오려면
어떻게 수정해야 되나요?
<?
if (!defined('_GNUBOARD_')) exit;
// 최신글 추출
function latest($skin_dir="", $bo_table, $rows=10, $subject_len=40, $options="", $sca="", $sfl = "", $stx="")
{
global $g4;
if ($skin_dir)
$latest_skin_path = "$g4[path]/skin/latest/$skin_dir";
else
$latest_skin_path = "$g4[path]/skin/latest/basic";
$list = array();
$sql_search = "";
$sql = " select * from $g4[board_table] where bo_table = '$bo_table'";
$board = sql_fetch($sql);
$tmp_write_table = $g4['write_prefix'] . $bo_table; // 게시판 테이블 전체이름
if ($sca || $stx)
{
$sql_search = get_sql_search($sca, $sfl, $stx);
$sql_search = "and ".$sql_search;
}
if($options=='notice'){
$notice_rows=count( split("\n", trim($board[bo_notice]) ) );
if( $rows> $notice_rows) $rows= $notice_rows;
$sql = " select * from $tmp_write_table where wr_is_comment = 0 and INSTR('$board[bo_notice]', wr_id)>0 $sql_search order by wr_num limit 0, $rows ";
}
$result = sql_query($sql);
for ($i=0; $row = sql_fetch_array($result); $i++)
$list[$i] = get_list($row, $board, $latest_skin_path, $subject_len);
ob_start();
include "$latest_skin_path/latest.skin.php";
$content = ob_get_contents();
ob_end_clean();
return $content;
}
?>
아래는 공지사항을 체크한 게시물만 불러오는 latest lib 입니다.
여기서 반대로 공지사항을 체크하지 않은 게시물만 불러오려면
어떻게 수정해야 되나요?
<?
if (!defined('_GNUBOARD_')) exit;
// 최신글 추출
function latest($skin_dir="", $bo_table, $rows=10, $subject_len=40, $options="", $sca="", $sfl = "", $stx="")
{
global $g4;
if ($skin_dir)
$latest_skin_path = "$g4[path]/skin/latest/$skin_dir";
else
$latest_skin_path = "$g4[path]/skin/latest/basic";
$list = array();
$sql_search = "";
$sql = " select * from $g4[board_table] where bo_table = '$bo_table'";
$board = sql_fetch($sql);
$tmp_write_table = $g4['write_prefix'] . $bo_table; // 게시판 테이블 전체이름
if ($sca || $stx)
{
$sql_search = get_sql_search($sca, $sfl, $stx);
$sql_search = "and ".$sql_search;
}
if($options=='notice'){
$notice_rows=count( split("\n", trim($board[bo_notice]) ) );
if( $rows> $notice_rows) $rows= $notice_rows;
$sql = " select * from $tmp_write_table where wr_is_comment = 0 and INSTR('$board[bo_notice]', wr_id)>0 $sql_search order by wr_num limit 0, $rows ";
}
$result = sql_query($sql);
for ($i=0; $row = sql_fetch_array($result); $i++)
$list[$i] = get_list($row, $board, $latest_skin_path, $subject_len);
ob_start();
include "$latest_skin_path/latest.skin.php";
$content = ob_get_contents();
ob_end_clean();
return $content;
}
?>
댓글 전체
$sql = " select * from $tmp_write_table where wr_is_comment = 0 and INSTR('$board[bo_notice]', wr_id)>0 $sql_search order by wr_num limit 0, $rows ";
부분을 instr 을 이용하셔서 wr_id 값이 없으면 공지가 아니므로 0을 반환 합니다 아래같이 변경하시면됩니다
$sql = " select * from $tmp_write_table where wr_is_comment = 0 and INSTR('$board[bo_notice]', wr_id)<1 $sql_search order by wr_num limit 0, $rows ";
부분을 instr 을 이용하셔서 wr_id 값이 없으면 공지가 아니므로 0을 반환 합니다 아래같이 변경하시면됩니다
$sql = " select * from $tmp_write_table where wr_is_comment = 0 and INSTR('$board[bo_notice]', wr_id)<1 $sql_search order by wr_num limit 0, $rows ";

밀크님 답변 감사드립니다. :) 아주 잘되요.ㅎ
새해 복 많이 받으시구요, 내년에도 많이많이 가르침주세요.ㅎ~
진짜 최고입니다! :)
새해 복 많이 받으시구요, 내년에도 많이많이 가르침주세요.ㅎ~
진짜 최고입니다! :)

공지체크 안한 최근게시물 불러오기 입니다. [밀크님 완성] :)
필요하시분 있으시면, 아래 소스를 쓰시면 됩니다.
<?
if (!defined('_GNUBOARD_')) exit;
// 최신글 추출
function paging($skin_dir="", $bo_table, $rows=10, $subject_len=40, $options="", $sca="", $sfl = "", $stx="")
{
global $g4;
if ($skin_dir)
$latest_skin_path = "$g4[path]/skin/latest/$skin_dir";
else
$latest_skin_path = "$g4[path]/skin/latest/basic";
$list = array();
$sql_search = "";
$sql = " select * from $g4[board_table] where bo_table = '$bo_table'";
$board = sql_fetch($sql);
$tmp_write_table = $g4['write_prefix'] . $bo_table; // 게시판 테이블 전체이름
if ($sca || $stx)
{
$sql_search = get_sql_search($sca, $sfl, $stx);
$sql_search = "and ".$sql_search;
}
if($options=='notice'){
$notice_rows=count( split("n", trim($board[bo_notice]) ) );
if( $rows< $notice_rows) $rows= $notice_rows;
$sql = " select * from $tmp_write_table where wr_is_comment = 0 and INSTR('$board[bo_notice]', wr_id)<1 $sql_search order by wr_num limit 0, $rows ";
}
$result = sql_query($sql);
for ($i=0; $row = sql_fetch_array($result); $i++)
$list[$i] = get_list($row, $board, $latest_skin_path, $subject_len);
ob_start();
include "$latest_skin_path/latest.skin.php";
$content = ob_get_contents();
ob_end_clean();
return $content;
}
?>
필요하시분 있으시면, 아래 소스를 쓰시면 됩니다.
<?
if (!defined('_GNUBOARD_')) exit;
// 최신글 추출
function paging($skin_dir="", $bo_table, $rows=10, $subject_len=40, $options="", $sca="", $sfl = "", $stx="")
{
global $g4;
if ($skin_dir)
$latest_skin_path = "$g4[path]/skin/latest/$skin_dir";
else
$latest_skin_path = "$g4[path]/skin/latest/basic";
$list = array();
$sql_search = "";
$sql = " select * from $g4[board_table] where bo_table = '$bo_table'";
$board = sql_fetch($sql);
$tmp_write_table = $g4['write_prefix'] . $bo_table; // 게시판 테이블 전체이름
if ($sca || $stx)
{
$sql_search = get_sql_search($sca, $sfl, $stx);
$sql_search = "and ".$sql_search;
}
if($options=='notice'){
$notice_rows=count( split("n", trim($board[bo_notice]) ) );
if( $rows< $notice_rows) $rows= $notice_rows;
$sql = " select * from $tmp_write_table where wr_is_comment = 0 and INSTR('$board[bo_notice]', wr_id)<1 $sql_search order by wr_num limit 0, $rows ";
}
$result = sql_query($sql);
for ($i=0; $row = sql_fetch_array($result); $i++)
$list[$i] = get_list($row, $board, $latest_skin_path, $subject_len);
ob_start();
include "$latest_skin_path/latest.skin.php";
$content = ob_get_contents();
ob_end_clean();
return $content;
}
?>
공지사항만 입력한 것만 뽑아오는 경우는 어떤 것을 수정하면 될까요?