G

공지글만 최신글에서 출력하고 싶습니다.

최근 게시물(latest)에서 공지로 표시된 글들만 출력을 하는 스킨을 만들고 싶습니다.

공지를 체크하면 DB의 어느 필드에 값이 들어가는 겁니까?
|

댓글 5개

g4_board 테이블에
bo_table 테이블명과 bo_notice (text type)가 있습니다.
이 레코드에 줄바꿈+글번호만 추가됩니다.

bbs/list.php 의
.
.

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

split으로 공지글이 몇번이다를 배열에 넣습니다.
감사합니다. 찾아보겠습니다. ^^
호호 그렇군요..저도함해봐야겠네요
공지금만 출력하기
lib/ 아래에 lib/latest1.lib.php 파일을 생성하세요.
<!-- latest1.lib.php 파일에 아래내용을 넣고 저장-->
<?
if (!defined('_GNUBOARD_')) exit;

// 최신글 추출
function latest1($skin_dir="", $bo_table, $rows=10, $subject_len=40, $options="")
{
global $config;
global $g4;
if ($skin_dir)
$latest_skin_path = "$g4[path]/skin/latest/$skin_dir";
else
$latest_skin_path = "$g4[path]/skin/latest/$config[cf_latest_skin]";
$list = array();
$sql = " select * from {$g4[board_table]} where bo_table = '$bo_table'";
$board = sql_fetch($sql);
$arr_notice = split("\n", trim($board[bo_notice]));
if($board[bo_notice] ) // 이렇게 고치니 되네요..참고하세요..
$in_str= implode( ",", $arr_notice);
else $in_str='null';

$tmp_write_table = $g4['write_prefix'] . $bo_table;
$sql = "select * from $tmp_write_table where wr_id in ( $in_str) 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;
}
?>

적용은 넣으려는 페이지의 php파일 상단에
<?
$g4_path = "./board";
include_once("_common.php");
include_once("./_common.php");
include_once("$g4[path]/lib/latest.lib.php");
include_once("$g4[path]/lib/latest1.lib.php"); //이걸넣으세요
include_once("$g4[path]/lib/outlogin.lib.php");
?>
이처럼 넣어주시고

적용할 부분에 다가 아래처럼
<?=latest1("basic","notice","6","33","wr_id","notice");?>

이렇게 넣어주시면 제대로 노출됩니다.
댓글을 작성하시려면 로그인이 필요합니다.

그누4 질문답변

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

+
제목 글쓴이 날짜 조회
20년 전 조회 1,522
20년 전 조회 2,811
20년 전 조회 2,184
20년 전 조회 1,537
20년 전 조회 1,436
20년 전 조회 2,087
20년 전 조회 1,518
20년 전 조회 1,766
20년 전 조회 1,557
20년 전 조회 1,781
20년 전 조회 1,515
20년 전 조회 1,526
20년 전 조회 1,518
20년 전 조회 1,547
20년 전 조회 1,608
20년 전 조회 1,591
20년 전 조회 1,518
20년 전 조회 1,575
20년 전 조회 1,512
20년 전 조회 1,709
🐛 버그신고