각 게시판의 총 글갯수를 표시하려면 어떻게 해야하나요? > 그누4 질문답변

그누4 질문답변

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

각 게시판의 총 글갯수를 표시하려면 어떻게 해야하나요? 정보

각 게시판의 총 글갯수를 표시하려면 어떻게 해야하나요?

본문

메인에 수동으로 메뉴를 만들었습니다.
 
공지
자유게시판
질문하기
    .
    .
 
가령 자유게시판이라면
 
자유게시판 (글갯수) ... 이런식으로 괄호안에 자유게시판의 총게시물갯수를 표시하고 싶습니다.
 
<?php
//24시간 이내의 글 수 알아내기
function new_count($table_id){
// 오늘을 불러옵니다.
$intime = date("Y-m-d H:i:s", time() - (int)(60 * 60 * 24));

// 여기는 오늘과 글쓴 날짜를 비교합니다.
$tmp_write_table .= "g4_write_$table_id";
$sql2 = " select wr_datetime from $tmp_write_table where wr_datetime >= '$intime'";

// 새로운 글이 몇개 있는지 확인합니다.
$result2 = sql_query($sql2);
$total_count = mysql_num_rows($result2);

if ($total_count > 0) {
$str_cnt .= " [".$total_count."]";
return $str_cnt;
}
else {
$str_cnt .= "";
return $str_cnt;
}
}
?>
위는 새글을 표시하는 소스이던데 이거 뭐 어떻게 수정해야 새글이 아닌 총게시물수를 표시할수있을까요?
  • 복사

댓글 전체

아래 코드를 참고하세요

$bo_table = 'free'; // 게시판 id
$row = sql_fetch("select bo_count_write from $g4[board_table] where bo_table='{$bo_table}'");
$total_count = $row[bo_count_write];
echo "총개시물 : ". $total_count;
알려주신대로는 자유게시판 하나만의 전체게시물수는 표시할수있는데 또 다른 게시판들도 같이 표시하게 하려면
어떻게해야하는지요?

function t_count($bo_table){
$row = sql_fetch("select bo_count_write from $g4[board_table] where bo_table='{$bo_table}'");
$total_count = $row[bo_count_write];
}
이렇게 하고
자유게시판 <?=t_count(게시판id)?>
이렇게 넣었더니 에러나네요 ;;;;
function t_count($bo_table){
global $g4;
$row = sql_fetch("select bo_count_write from $g4[board_table] where bo_table='{$bo_table}'");
$total_count = $row[bo_count_write];
return $total_count;
}

echo t_count("free");

와 같은 형식으로 해보십시오.
© SIRSOFT
현재 페이지 제일 처음으로