관리자가 원하는 게시물만 최근게시물로~ 정보
관리자가 원하는 게시물만 최근게시물로~본문
안녕하세요. 질문드립니다.
관리자가 원하는 게시물만 최근게시물로 제작하는 방법이 있습니까?
게시판을 수정해야 하는것이죠? 그럼 db 테이블을 추가해야 하는 것인가요?
최근에 올라온 최근게시물이 아닌, 운영자가 원하는 게시물을 최근게시물로 올려놓으려고 합니다.
글을 좀 찾아보았는데, 키워드를 잘못 입력했는지 나오지 않네요...
db나 게시판 제작에 대해서 잘 몰라서 애매합니다.^^
구현방법에 대해서 알고계시면 답변 부탁드립니다.
댓글 전체
1. 여분필드에 값을 설정한다.(순서정도)
2. 최근게시물 처리 함수를 카피해서 새로운 함수를 하나 만든다
3. 카피한 함수에서 조회조건에 여분필드에 선택된값이 있는것만 가져오도록 수정한다
순서는 order by로 정렬한다
4. 최근게시물 처리할부분에 새로 만든 최신글 함수를 호출한다.
2. 최근게시물 처리 함수를 카피해서 새로운 함수를 하나 만든다
3. 카피한 함수에서 조회조건에 여분필드에 선택된값이 있는것만 가져오도록 수정한다
순서는 order by로 정렬한다
4. 최근게시물 처리할부분에 새로 만든 최신글 함수를 호출한다.

대충 이런 정도로 하면
// 최신글 추출
function latest($skin_dir="", $bo_table, $rows=10, $subject_len=40, $options="", $yes)
{
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; // 게시판 테이블 전체이름
$sql = " select * from $tmp_write_table where wr_is_comment = 0 and wr_1 = '$yes' order by wr_id desc limit 0, $rows ";
//explain($sql);
$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;
}
echo latest(스킨, 보드명, 출력게시물수, 제목글수, 옵션, "OK");
그리고 게시판에서 wr_1에 혹은 원하는 필드에 값을 Y 또는 OK 값을 주고
그 값이 있다면 출력.......
// 최신글 추출
function latest($skin_dir="", $bo_table, $rows=10, $subject_len=40, $options="", $yes)
{
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; // 게시판 테이블 전체이름
$sql = " select * from $tmp_write_table where wr_is_comment = 0 and wr_1 = '$yes' order by wr_id desc limit 0, $rows ";
//explain($sql);
$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;
}
echo latest(스킨, 보드명, 출력게시물수, 제목글수, 옵션, "OK");
그리고 게시판에서 wr_1에 혹은 원하는 필드에 값을 Y 또는 OK 값을 주고
그 값이 있다면 출력.......

위의 글을 수정한다면......
이렇게 해도 될 듯도 합니다.
$sql = " select * from $tmp_write_table where wr_is_comment = 0 order by wr_id desc limit 0, $rows ";
//explain($sql);
$result = sql_query($sql);
for ($i=0; $row = sql_fetch_array($result); $i++)
if($row[wr_1] == $yes){ $list[$i] = get_list($row, $board, $latest_skin_path, $subject_len); }
echo latest(스킨, 보드명, 출력게시물수, 제목글수, 옵션, "OK");
이렇게 해도 될 듯도 합니다.
$sql = " select * from $tmp_write_table where wr_is_comment = 0 order by wr_id desc limit 0, $rows ";
//explain($sql);
$result = sql_query($sql);
for ($i=0; $row = sql_fetch_array($result); $i++)
if($row[wr_1] == $yes){ $list[$i] = get_list($row, $board, $latest_skin_path, $subject_len); }
echo latest(스킨, 보드명, 출력게시물수, 제목글수, 옵션, "OK");