엑스엠엘 님 latest관련질문이요 정보
엑스엠엘 님 latest관련질문이요본문
여러게시판에서 글을 추출하는팁인데요~
http://sir.co.kr/bbs/tb.php/g4_tiptech/15476/e61d65519f2be2e4f007077132cd3804
추출하는것은 가능한데요~ 이것을 히트수로 출력하는방법좀 알려주세요~
<?=latest_group("simple", array( 'ha_1_n1', 'ha_1_n2', 'ha_1_n3'), 1, 30, "H"); ?>
마지막에 "H"들거나것처럼요
제가 해볼려고 하는데 힘이드네요 ㅜㅜ
<?
if (!defined('_GNUBOARD_')) exit;
function quoting(&$item1, $key) { $item1 = "'$item1'"; }
// 최신글 추출
function latest_group( $skin_dir, $bo_tables, $rows=10, $subject_len="", $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();
$rows2 = $rows * 1; // 비밀글을 제외할 때 rows가 부족할까봐 여유있게
array_walk( $bo_tables , 'quoting');
$bo_tables= implode( ',', $bo_tables);
$sql = " select bo_table, wr_id from $g4[board_new_table] where bo_table in ( $bo_tables ) and wr_is_comment=0 order by bn_id desc limit 0, $rows2 ";
$result = sql_query($sql);
$j = 0;
while ($row = sql_fetch_array($result)) {
if ($j > $rows) break; // rows에 지정된거보다 많으면 loop를 중단. 비밀글이 많으면 rows보다 적은 열이 return됨 (그대로 오꼭?중요하죠)
// 게시판 테이블
$sql3 = " select * from $g4[board_table] where bo_table = '$row[bo_table]'";
$board = sql_fetch($sql3);
$tmp_write_table = $g4[write_prefix] . $row[bo_table];
$sql2 = " select * from $tmp_write_table where wr_id = '$row[wr_id]' ";
$row2 = sql_fetch($sql2);
if (!strstr($row2[wr_option], "secret")) {
$list[$j] = get_list($row2, $board, $latest_skin_path, $subject_len);
$list[$j][bo_name] = $board[bo_subject];
$j++;
}
}
// 옵션
if ($options == 'R') {
// 랜덤
$sql_options = "rand()";
}
else if ($options == 'H') {
// 히트순
$sql_options = "wr_hit desc";
}
else if ($options == 'C') {
// 코멘트
$sql_options = "wr_comment desc";
}
else if ($options == 'G') {
// 추천
$sql_options = "wr_good desc, wr_num";
$sql_not = "wr_nogood = '0' and";
}
else if ($options == 'N') {
// 비추천
$sql_options = "wr_nogood desc";
} else {
// 기본
$sql_options = "wr_num";
}
$result4 = sql_fetch(" select gr_subject from $g4[group_table] where gr_id = '$gr_id' ");
$skin_title = "$result4[gr_subject]";
$skin_title_link = "?url=$g4[bbs_path]/new.php?gr_id=$gr_id";
ob_start();
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&sca=&sfl=wr_subject%7C%7Cwr_content&stx=%B1%D7%B7%EC+%C3%D6%BD%C5&sop=and
이 팁을 참고하시는 것이 좋을 듯합니다.
g4_board_new에서는 가져올 수 없는 거라서요.