lastest에서 공지사항을 체크하지 않은 게시물만 불러오려면? > 그누4 질문답변

그누4 질문답변

그누보드4 관련 질문은 QA 로 이전됩니다. QA 그누보드4 바로가기
기존 게시물은 열람만 가능합니다.

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;
}
?>

댓글 전체

$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 ";
공지체크 안한 최근게시물 불러오기 입니다. [밀크님 완성] :)
필요하시분 있으시면, 아래 소스를 쓰시면 됩니다.

<?
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;
}
?>
전체 66,554 |RSS
그누4 질문답변 내용 검색

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1402호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT