그누보드 [G4] 최신글 공지만 출력 또는 공지 빼고 출력하기
페이지 정보
본문
<?php
// 그누보드4 ... 공지글만 출력(추출)하기
// echo latest_Notice("스킨이름","게시판이름",추출수,제목길이,"옵션" );
function latest_Notice($skin_dir="", $bo_table, $rows=10, $subject_len=40, $options="") {
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 = " select * from {$g4['board_table']} where bo_table = '$bo_table'";
$board = sql_fetch($sql);
$tmp_write_table = $g4['write_prefix'] . $bo_table; // 게시판 테이블 전체이름
$arr_notice = preg_replace("/\n/",',', trim($board['bo_notice']));
if(!$arr_notice) $arr_notice=0;
$result = sql_query(" select * from {$tmp_write_table} where wr_id IN({$arr_notice}) order by wr_num limit 0, {$rows}");
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;
}
// 그누보드4 ... 공지글 랜덤으로 뿌리기
// echo latest_NoticeRand("스킨이름","게시판이름",추출수,제목길이,"옵션" );
function latest_NoticeRand($skin_dir="", $bo_table, $rows=10, $subject_len=40, $options="")
{
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 = " select * from {$g4['board_table']} where bo_table = '{$bo_table}'";
$board = sql_fetch($sql);
$tmp_write_table = $g4['write_prefix'] . $bo_table; // 게시판 테이블 전체이름
$arr_notice = preg_replace("/\n/",',', trim($board['bo_notice']));
if(!$arr_notice) $arr_notice=0;
$result = sql_query(" select * from {$tmp_write_table} where wr_id IN({$arr_notice}) order by rand() limit 0, {$rows}");
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;
}
// 그누보드4 ... 공지와 답변 제외한 일반글 추출하기
// echo latest_NoNotice("스킨이름","게시판이름",추출수,제목길이,"옵션" );
function latest_NoNotice($skin_dir="", $bo_table, $rows=10, $subject_len=40, $options="")
{
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 = " select * from {$g4['board_table']} where bo_table = '{$bo_table}'";
$board = sql_fetch($sql);
// 답변글 출력제외
$subqry1 = "&& wr_reply = ''";
// 공지사항 출력제외
$arr_notice = split("\n", trim($board['bo_notice']));
for ($k=0; $k<count($arr_notice); $k++) {
$subqry2_1 = " && wr_id!='$arr_notice[$k]'";
$subqry2 = "$subqry2 $subqry2_1";
}
$tmp_write_table = $g4['write_prefix'] . $bo_table; // 게시판 테이블 전체이름
$sql = " select * from {$tmp_write_table} where wr_is_comment = 0 {$subqry1} {$subqry2} order by wr_id desc 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;
}
// 그누보드4 ... 공지와 답변 제외한 일반글을 랜덤으로 추출하기
// echo latest_NoNoticeRand("스킨이름","게시판이름",추출수,제목길이,"옵션" );
function latest_NoNoticeRand($skin_dir="", $bo_table, $rows=10, $subject_len=40, $options="")
{
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 = " select * from {$g4['board_table']} where bo_table = '{$bo_table}'";
$board = sql_fetch($sql);
// 답변글 출력제외
$subqry1 = "&& wr_reply = ''";
// 공지사항 출력제외
$arr_notice = split("\n", trim($board['bo_notice']));
for ($k=0; $k<count($arr_notice); $k++) {
$subqry2_1 = " && wr_id!='$arr_notice[$k]'";
$subqry2 = "$subqry2 $subqry2_1";
}
$tmp_write_table = $g4['write_prefix'] . $bo_table; // 게시판 테이블 전체이름
$sql = " select * from {$tmp_write_table} where wr_is_comment = 0 {$subqry1} {$subqry2} order by rand() desc 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;
}
?>
관련자료
http://sir.kr/g4_tiptech/32081
http://sir.kr/bbs/board.php?bo_table=g4_tiptech&wr_id=5611
// 그누보드4 ... 공지글만 출력(추출)하기
// echo latest_Notice("스킨이름","게시판이름",추출수,제목길이,"옵션" );
function latest_Notice($skin_dir="", $bo_table, $rows=10, $subject_len=40, $options="") {
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 = " select * from {$g4['board_table']} where bo_table = '$bo_table'";
$board = sql_fetch($sql);
$tmp_write_table = $g4['write_prefix'] . $bo_table; // 게시판 테이블 전체이름
$arr_notice = preg_replace("/\n/",',', trim($board['bo_notice']));
if(!$arr_notice) $arr_notice=0;
$result = sql_query(" select * from {$tmp_write_table} where wr_id IN({$arr_notice}) order by wr_num limit 0, {$rows}");
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;
}
// 그누보드4 ... 공지글 랜덤으로 뿌리기
// echo latest_NoticeRand("스킨이름","게시판이름",추출수,제목길이,"옵션" );
function latest_NoticeRand($skin_dir="", $bo_table, $rows=10, $subject_len=40, $options="")
{
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 = " select * from {$g4['board_table']} where bo_table = '{$bo_table}'";
$board = sql_fetch($sql);
$tmp_write_table = $g4['write_prefix'] . $bo_table; // 게시판 테이블 전체이름
$arr_notice = preg_replace("/\n/",',', trim($board['bo_notice']));
if(!$arr_notice) $arr_notice=0;
$result = sql_query(" select * from {$tmp_write_table} where wr_id IN({$arr_notice}) order by rand() limit 0, {$rows}");
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;
}
// 그누보드4 ... 공지와 답변 제외한 일반글 추출하기
// echo latest_NoNotice("스킨이름","게시판이름",추출수,제목길이,"옵션" );
function latest_NoNotice($skin_dir="", $bo_table, $rows=10, $subject_len=40, $options="")
{
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 = " select * from {$g4['board_table']} where bo_table = '{$bo_table}'";
$board = sql_fetch($sql);
// 답변글 출력제외
$subqry1 = "&& wr_reply = ''";
// 공지사항 출력제외
$arr_notice = split("\n", trim($board['bo_notice']));
for ($k=0; $k<count($arr_notice); $k++) {
$subqry2_1 = " && wr_id!='$arr_notice[$k]'";
$subqry2 = "$subqry2 $subqry2_1";
}
$tmp_write_table = $g4['write_prefix'] . $bo_table; // 게시판 테이블 전체이름
$sql = " select * from {$tmp_write_table} where wr_is_comment = 0 {$subqry1} {$subqry2} order by wr_id desc 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;
}
// 그누보드4 ... 공지와 답변 제외한 일반글을 랜덤으로 추출하기
// echo latest_NoNoticeRand("스킨이름","게시판이름",추출수,제목길이,"옵션" );
function latest_NoNoticeRand($skin_dir="", $bo_table, $rows=10, $subject_len=40, $options="")
{
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 = " select * from {$g4['board_table']} where bo_table = '{$bo_table}'";
$board = sql_fetch($sql);
// 답변글 출력제외
$subqry1 = "&& wr_reply = ''";
// 공지사항 출력제외
$arr_notice = split("\n", trim($board['bo_notice']));
for ($k=0; $k<count($arr_notice); $k++) {
$subqry2_1 = " && wr_id!='$arr_notice[$k]'";
$subqry2 = "$subqry2 $subqry2_1";
}
$tmp_write_table = $g4['write_prefix'] . $bo_table; // 게시판 테이블 전체이름
$sql = " select * from {$tmp_write_table} where wr_is_comment = 0 {$subqry1} {$subqry2} order by rand() desc 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;
}
?>
관련자료
http://sir.kr/g4_tiptech/32081
http://sir.kr/bbs/board.php?bo_table=g4_tiptech&wr_id=5611
댓글목록
등록된 댓글이 없습니다.