메뉴에서 게시판 전체글/오늘글 갯수 뽑기
예) 자유게시판 23/4 (전체글 23개, 오늘글 4개)
이런 식으로 출력되게 하는 팁입니다.
아래 소스를 extend/extend.lib.php에 올립니다.
<?
// 전체글/오늘글
function total_today($bo_table, $fcolor) /// $fcolor는 글자색깔
{
global $g4;
$intime = date("Y-m-d H:i:s", time() - (int)(60 * 60 * 24));
$sqlCnum = " select count(*) as Cnum from {$g4['write_prefix']}{$bo_table} where wr_is_comment = 0 ";
$rowCnum = sql_fetch($sqlCnum);
$sqlCnumT = " select count(*) as CnumT from {$g4['write_prefix']}{$bo_table} where wr_is_comment = 0 and wr_datetime >= '$intime'";
$rowCnumT = sql_fetch($sqlCnumT);
ob_start();
echo " <span style='font-size:7pt;color:{$fcolor};'>";
echo $rowCnum[Cnum];
if ($rowCnumT[CnumT] > 0) echo "/".$rowCnumT[CnumT];
echo "</span>";
$content = ob_get_contents();
ob_end_clean();
return $content;
}
// 전체글/오늘글_카테고리
function total_todayCate($bo_table, $ca_name, $fcolor) ///$fcolor는 글자색깔
{
global $g4;
$intime = date("Y-m-d H:i:s", time() - (int)(60 * 60 * 24));
$C = $ca_name;
$sqlCnumC = " select count(*) as CnumC from {$g4['write_prefix']}{$bo_table} where wr_is_comment = 0 and ca_name = '$ca_name' ";
$rowCnumC = sql_fetch($sqlCnumC);
$sqlCnumTC = " select count(*) as CnumTC from {$g4['write_prefix']}{$bo_table} where wr_is_comment = 0 and ca_name = '$ca_name' and wr_datetime >= '$intime' ";
$rowCnumTC = sql_fetch($sqlCnumTC);
ob_start();
echo " <span style='font-size:7pt;color:{$fcolor};'>";
echo $rowCnumC[CnumC];
if ($rowCnumTC[CnumTC] > 0) echo "/".$rowCnumTC[CnumTC];
echo "</span>";
$content = ob_get_contents();
ob_end_clean();
return $content;
}
?>
이제 메뉴의 적당한 부분에 아래 소스를 넣으면 됩니다.
<?
echo total_today("게시판명", "#6699ff"); //게시판 제목 옆에. 게시글 전체 해당
?>
<?
echo total_todayCate("게시판명", "카테고리명", "#6699ff"); //카테고리 이름 옆에. 카테고리별 해당
?>
댓글 5개
15년 전
감사용
14년 전
감사합니다.
14년 전
감사합니다~
13년 전
굿
12년 전
감사합니당!!
게시판 목록
그누4 팁자료실
그누보드4와 관련된 팁을 여러분들과 함께 공유하세요.
나누면 즐거움이 커집니다.
나누면 즐거움이 커집니다.
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 3169 | 12년 전 | 11449 | ||
| 3168 | 12년 전 | 8363 | ||
| 3167 | 12년 전 | 9524 | ||
| 3166 | 12년 전 | 8624 | ||
| 3165 | 12년 전 | 3853 | ||
| 3164 | 12년 전 | 5780 | ||
| 3163 | 12년 전 | 5485 | ||
| 3162 | 12년 전 | 7512 | ||
| 3161 |
다케미카코
|
12년 전 | 5657 | |
| 3160 | 12년 전 | 5980 | ||
| 3159 | 12년 전 | 5823 | ||
| 3158 | 12년 전 | 4214 | ||
| 3157 |
izabella
|
12년 전 | 8332 | |
| 3156 | 12년 전 | 6299 | ||
| 3155 | 12년 전 | 3783 | ||
| 3154 | 12년 전 | 8916 | ||
| 3153 | 12년 전 | 3598 | ||
| 3152 |
다케미카코
|
12년 전 | 6563 | |
| 3151 | 12년 전 | 5431 | ||
| 3150 |
|
12년 전 | 4803 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기