최신글 그룹 히트순 글추출.. 정보
최신글 그룹 히트순 글추출..본문
안녕하세요..
그룹에서 히트수가 많은 글을 뽑을려고 하는데요..
지금 사용하는건 기간에 상관없이 무조건 히트순으로 뽑히는 바람에..
너무 옛날 글도 자꾸 추출되서 말입니다..
최근 일주일내라던지.. 최신글에서 히트순으로 뽑았으면 좋겠는데..
<?
if (!defined('_GNUBOARD_')) exit;
/// 함수 정의 시작
if (!defined('_GNUBOARD_')) exit;
/// 함수 정의 시작
// 최신글 추출 - 선택한 그룹별로 원하는 수만큼 보여줌
function latest_group($skin_dir="", $gr_id, $rows=10, $subject_len=40, $category="", $orderby="")
{
global $config;
global $g4;
function latest_group($skin_dir="", $gr_id, $rows=10, $subject_len=40, $category="", $orderby="")
{
global $config;
global $g4;
$list = array();
$limitrows = $rows;
$limitrows = $rows;
$sqlgroup = " select bo_table, bo_subject from $g4[board_table] where gr_id = '$gr_id' and bo_use_search=1 order by bo_order_search";
$rsgroup = sql_query($sqlgroup);
$rsgroup = sql_query($sqlgroup);
if ($skin_dir)
$latest_skin_path = "$g4[path]/skin/latest/$skin_dir";
else
$latest_skin_path = "$g4[path]/skin/latest/$config[cf_latest_skin]";
$latest_skin_path = "$g4[path]/skin/latest/$skin_dir";
else
$latest_skin_path = "$g4[path]/skin/latest/$config[cf_latest_skin]";
for ($j=0, $k=0; $rowgroup=sql_fetch_array($rsgroup); $j++) {
$bo_table = $rowgroup[bo_table];
$bo_table = $rowgroup[bo_table];
// 테이블 이름구함
$sql = " select * from {$g4[board_table]} where bo_table = '$bo_table'";
$board = sql_fetch($sql);
$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 ";
$sql .= (!$category) ? "" : " and ca_name = '$category' ";
$sql .= (!$orderby) ? " order by wr_id desc " : " order by $orderby desc, wr_id desc ";
$sql .= " limit $limitrows";
$sql = "select * from $tmp_write_table where wr_is_comment = 0 ";
$sql .= (!$category) ? "" : " and ca_name = '$category' ";
$sql .= (!$orderby) ? " order by wr_id desc " : " order by $orderby desc, wr_id desc ";
$sql .= " limit $limitrows";
$result = sql_query($sql);
for ($i=0; $row = sql_fetch_array($result); $i++, $k++) {
if(!$orderby) $op_list[$k] = $row[wr_datetime];
else {
$op_list[$k] = is_string($row[$orderby]) ? sprintf("%-256s", $row[$orderby]) : sprintf("%016d", $row[$orderby]);
$op_list[$k] .= $row[wr_datetime];
}
else {
$op_list[$k] = is_string($row[$orderby]) ? sprintf("%-256s", $row[$orderby]) : sprintf("%016d", $row[$orderby]);
$op_list[$k] .= $row[wr_datetime];
}
$list[$k] = get_list($row, $board, $latest_skin_path, $subject_len);
$list[$k][subject] = cut_str($list[$k][wr_subject], $subject_len);
}
}
if($k>0) array_multisort($op_list, SORT_DESC, $list);
if($k>$rows) array_splice($list, $rows);
}
}
if($k>0) array_multisort($op_list, SORT_DESC, $list);
if($k>$rows) array_splice($list, $rows);
ob_start();
include "$latest_skin_path/latest.skin.php";
$content = ob_get_contents();
ob_end_clean();
return $content;
}
/// 함수 정의 끝
?>
include "$latest_skin_path/latest.skin.php";
$content = ob_get_contents();
ob_end_clean();
return $content;
}
/// 함수 정의 끝
?>
현재 제가 사용하고있는 겁니다.
부탁드립니다..
수고하십시요.
댓글 전체
http://sir.co.kr/bbs/board.php?bo_table=g4_tiptech&wr_id=8790&sca=&sfl=wr_subject%7C%7Cwr_content&stx=%C3%D6%BD%C5%B1%DB+%B1%D7%B7%EC+%C8%F7%C6%AE%BC%F8&sop=and
http://www.sir.co.kr/bbs/board.php?bo_table=g4_tiptech&wr_id=7328
http://sir.co.kr/bbs/board.php?bo_table=g4_tiptech&wr_id=1843&sca=&sfl=wr_subject%7C%7Cwr_content&stx=latest_group&sop=and
원 게시물의 소스코드 뿐만 아니라,
게시물에 작성된 코멘트까지 참고하셔야 합니다.
http://www.sir.co.kr/bbs/board.php?bo_table=g4_tiptech&wr_id=7328
http://sir.co.kr/bbs/board.php?bo_table=g4_tiptech&wr_id=1843&sca=&sfl=wr_subject%7C%7Cwr_content&stx=latest_group&sop=and
원 게시물의 소스코드 뿐만 아니라,
게시물에 작성된 코멘트까지 참고하셔야 합니다.
아.. 그렇군요.. 감사합니다..