b

최신글 그룹 히트순 글추출..

안녕하세요..
 
그룹에서 히트수가 많은 글을 뽑을려고 하는데요..
 
지금 사용하는건 기간에 상관없이 무조건 히트순으로 뽑히는 바람에..
 
너무 옛날 글도 자꾸 추출되서 말입니다..
 
최근 일주일내라던지.. 최신글에서 히트순으로 뽑았으면 좋겠는데..
 
 
 
<?
if (!defined('_GNUBOARD_')) exit;
/// 함수 정의 시작
// 최신글 추출 - 선택한 그룹별로 원하는 수만큼 보여줌
function latest_group($skin_dir="", $gr_id, $rows=10, $subject_len=40, $category="", $orderby="")
{
global $config;
global $g4;
$list = array();
$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);
if ($skin_dir)
$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];
// 테이블 이름구함
$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";
$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];
}
$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);
ob_start();
include "$latest_skin_path/latest.skin.php";
$content = ob_get_contents();
ob_end_clean();
return $content;
}
/// 함수 정의 끝
?>
 
현재 제가 사용하고있는 겁니다.
 
부탁드립니다..
 
수고하십시요.
 
|

댓글 2개

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

원 게시물의 소스코드 뿐만 아니라,
게시물에 작성된 코멘트까지 참고하셔야 합니다.
아.. 그렇군요.. 감사합니다..
댓글을 작성하시려면 로그인이 필요합니다. 로그인

그누4 질문답변

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

+
제목 글쓴이 날짜 조회
19년 전 조회 1,551
19년 전 조회 1,718
19년 전 조회 1,505
19년 전 조회 1,509
19년 전 조회 1,641
19년 전 조회 2,226
19년 전 조회 1,715
19년 전 조회 1,563
19년 전 조회 1,548
19년 전 조회 1,681
19년 전 조회 1,629
19년 전 조회 1,567
19년 전 조회 1,999
19년 전 조회 2,896
19년 전 조회 1,536
19년 전 조회 1,673
19년 전 조회 2,247
19년 전 조회 1,614
19년 전 조회 5,669
19년 전 조회 1,555
🐛 버그신고