최신글을 특정글만 지정해서 나오게하는 방법 정보
최신글을 특정글만 지정해서 나오게하는 방법본문
메인에 최신글을 뽑아올때요
무조건 최근에 등록된 글 순으로 나오는데요.
이걸 관리자가 승인한 게시물만 최신글로 뽑아 올수없나요?
아래 질문에 엑스엠엘님께서 답글 보고 검색해보니 옵션으로 하는게 있드라구요.
그런데 현재 쓰는 latest.lib.php 에서 wr_2하나를 쓰고 있거든요.
이럴땐 어떻게 처리하나요?
도움 좀 부탁 드립니다^^;;
현재사용중인 latest.lib.php 소스
<?
if (!defined('_GNUBOARD_')) exit;
// 최신글 추출
function latest($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; // 게시판 테이블 전체이름
//$sql = " select * from $tmp_write_table where wr_is_comment = 0 order by wr_id desc limit 0, $rows ";
// 위의 코드 보다 속도가 빠름
//$sql = " select * from $tmp_write_table where wr_is_comment = 0 order by wr_num limit 0, $rows ";
if($options) $options="and wr_2='$options'";
$sql = " select * from $tmp_write_table where wr_is_comment = 0 $options order by wr_num 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;
}
?>
무조건 최근에 등록된 글 순으로 나오는데요.
이걸 관리자가 승인한 게시물만 최신글로 뽑아 올수없나요?
아래 질문에 엑스엠엘님께서 답글 보고 검색해보니 옵션으로 하는게 있드라구요.
그런데 현재 쓰는 latest.lib.php 에서 wr_2하나를 쓰고 있거든요.
이럴땐 어떻게 처리하나요?
도움 좀 부탁 드립니다^^;;
현재사용중인 latest.lib.php 소스
<?
if (!defined('_GNUBOARD_')) exit;
// 최신글 추출
function latest($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; // 게시판 테이블 전체이름
//$sql = " select * from $tmp_write_table where wr_is_comment = 0 order by wr_id desc limit 0, $rows ";
// 위의 코드 보다 속도가 빠름
//$sql = " select * from $tmp_write_table where wr_is_comment = 0 order by wr_num limit 0, $rows ";
if($options) $options="and wr_2='$options'";
$sql = " select * from $tmp_write_table where wr_is_comment = 0 $options order by wr_num 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;
}
?>
댓글 전체
function latest($skin_dir="", $bo_table, $rows=10, $subject_len=40, $options="")
위에 $optoons="" 비어있네요.. 아래 조건문을 보면
if($options) $options="and wr_2='$options'"; // 옵션값이 들어오면 쿼리문에 and wr_2='$options' 를 넣어서 처리한다는 듯.
옵션에 먼거 원하는 값이 들어있다면 실제론 wr_2 필드에 원하는 값 이 있다면
해당 값이 있는것만 출력시키는 구문인거 같아여~~^-^
위에 $optoons="" 비어있네요.. 아래 조건문을 보면
if($options) $options="and wr_2='$options'"; // 옵션값이 들어오면 쿼리문에 and wr_2='$options' 를 넣어서 처리한다는 듯.
옵션에 먼거 원하는 값이 들어있다면 실제론 wr_2 필드에 원하는 값 이 있다면
해당 값이 있는것만 출력시키는 구문인거 같아여~~^-^
삐굿님 latest.lib.php 소스 분석이 아니고요.
현재 $options을 wr_2 하나를 쓰고 있는데요.
다시 공지를 $options으로 하나더 부를수 있는 소스를 여쭌겁니다.
현재 $options을 wr_2 하나를 쓰고 있는데요.
다시 공지를 $options으로 하나더 부를수 있는 소스를 여쭌겁니다.