예시 : 자유게시판 120/2 이렇게 표현을 어떻게 할까요? > 그누4 질문답변

그누4 질문답변

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

예시 : 자유게시판 120/2 이렇게 표현을 어떻게 할까요? 정보

예시 : 자유게시판 120/2 이렇게 표현을 어떻게 할까요?

본문

게시판 명 [전체게시물 수]/[오늘게시물 수]

자유게시판 120/ 2
이렇식으로 표현을 준비하던중

자유게시판에서 전체 게시물 수를 뽑는 방법을 모르겠습니다.
찾아보니..
<?=$board[bo_count_write]?>
<?=$board[bo_count_comment]?>
게시물 <?=number_format($total_count)?>건
이런 방법이 있는데...

제가 원하는 방식은 메인 화면에 표현을 하는 것입니다.
위와 같은 방법을 써보았지만 되지가 않아서..
혹시 특정 게시판 전체 게시물 수를 뽑을 수 없을까요??

댓글 전체

//게시물수 리턴 (data[new_post]/data[all_post]/data[new_ment]/data[all_ment]
function get_board_count($bo_table){
    global $config;
    global $g4;
    $data = array();

    $sql = " select * from {$g4[board_table]} where table_id = '$bo_table'";
    $board = sql_fetch($sql);
$data[all_post] = $board[bo_count_write]; // ALL POST Count;
$data[all_ment] = $board[bo_count_comment]; // ALL MENT Count;

    $tmp_write_table = $g4[write_prefix] . $bo_table; // 게시판 테이블 전체이름
$STime = date("Y-m-d H:i:s", time() - (int)(60 * 60 * 24)); //24 시간이내 글만.

$sql = "SELECT wr_id FROM $tmp_write_table where wr_datetime >= '$STime' and wr_is_comment = 0";
$result = sql_query($sql);
    $new_post = mysql_num_rows($result);
$data[new_post]=$new_post; // NEW POST Count;

$sql = "SELECT wr_id FROM $tmp_write_table where wr_datetime >= '$STime' and wr_is_comment = 1";
$result = sql_query($sql);
    $new_ment = mysql_num_rows($result);
$data[new_ment]=$new_ment; // NEW MENT Count;

return $data;
}

이 함수를 이용한 사용법은

$data=get_board_count("freeboard"); //게시판 보드테이블 명
echo $data[all_post]; // 전체 개수
echo $data[new_post]; // 24시간이내 글수
echo $data[all_ment];// 전체 멘트수
echo $data[new_ment];//24시간이내 멘트수

이 소스를 응용 되지 않을까요?
전 지금 잘 먹히지가 않아서요..ㅡㅡ;;
news라는 게시판id 에서 뽑아온다면...
//이부분 수정했음...이라는 주석이 달린부분을 수정...

-----------------------------------------------------------------------------------------------------------------------------
<?
//게시물수 리턴 (data[new_post]/data[all_post]/data[new_ment]/data[all_ment]
function get_board_count($bo_table){
    global $config;
    global $g4;
    $data = array();
    $sql = " select * from {$g4[board_table]} where bo_table = '$bo_table'";  //이부분 수정했음
    $board = sql_fetch($sql);
$data[all_post] = $board[bo_count_write]; // ALL POST Count;
$data[all_ment] = $board[bo_count_comment]; // ALL MENT Count;

    $tmp_write_table = $g4[write_prefix] . $bo_table; // 게시판 테이블 전체이름
$STime = date("Y-m-d H:i:s", time() - (int)(60 * 60 * 24)); //24 시간이내 글만.

$sql = "SELECT wr_id FROM $tmp_write_table where wr_datetime >= '$STime' and wr_is_comment = 0";
$result = sql_query($sql);
    $new_post = mysql_num_rows($result);
$data[new_post]=$new_post; // NEW POST Count;

$sql = "SELECT wr_id FROM $tmp_write_table where wr_datetime >= '$STime' and wr_is_comment = 1";
$result = sql_query($sql);
    $new_ment = mysql_num_rows($result);
$data[new_ment]=$new_ment; // NEW MENT Count;

return $data;
}
?>
 
<?
$data=get_board_count("news"); //게시판 보드테이블 명
echo "전체 개수 ($data[all_post])<br>"; // 전체 개수
echo "24시간이내 글수 ($data[new_post])<br>"; // 24시간이내 글수
echo "전체 코멘트수 ($data[all_ment])<br>";// 전체 코멘트수
echo "24시간이내 코멘트수 ($data[new_ment])";//24시간이내 코멘트수 
?>
----------------------------------------------------------------------------------------------------------------------------------------
전체 66,554 |RSS
그누4 질문답변 내용 검색

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1402호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT