코멘트 갯수 "(특정시간내 갯수/전체코멘트수)"로 표시하기 정보
코멘트 갯수 "(특정시간내 갯수/전체코멘트수)"로 표시하기관련링크
http://threes.org
61회 연결
본문
최신글과 리스트에서 코멘트 갯수 "(특정시간내 갯수/전체코멘트수)"로 표시하기
이버젼은 그누보드가 패치될때마다 수정하셔야 되는것입니다.
1. 다음 내용을 lib/developer.lib.php에 추가한다.
// 코멘트에서 "(특정시간내 갯수/전체코멘트수)" 구하기
function get_comment_count($hours,$bo_table,$wrid, $wrcommentcnt)
{
global $cfg;
$intime = date("Y-m-d H:i:s", time() - (int)(60 * 60 * $hours));
$sql2 = " select count(wr_datetime)
from {$cfg[write_table_prefix]}{$bo_table}
where wr_parent_id = $wrid
and wr_commentcnt = 0
and wr_datetime >= '$intime' ";
$result2 = sql_fetch($sql2);
if($result2[0] > 0) {
$retstr = "($result2[0]/$wrcommentcnt)";
} else {
$retstr = "($wrcommentcnt)";
}
return $retstr;
}
2. 최신글에서 적용하기..(그누보드가 패치되면 수정해야함)
수정파일 : lib/latest.lib.php
수정전 :
// 코멘트 카운트
$list[$i][commentcnt] = "";
if ($row[wr_commentcnt] > 0) {
$list[$i][commentcnt] = "($row[wr_commentcnt])";
}
수정후 :
// 코멘트 카운트
$list[$i][commentcnt] = "";
if ($row[wr_commentcnt] > 0) {
$comment_count = get_comment_count(24,$bo_table,$row[wr_id],$row[wr_commentcnt]);
$list[$i][commentcnt] = $comment_count;
//$list[$i][commentcnt] = "($row[wr_commentcnt])"; // 원본 주석처리
}
3. 게시판에 적용하기..(그누보드가 패치되면 수정해야함)
수정파일 : bbs/gblist.php
수정전 :
$list[$i][commentcnt] = "";
if ($row[wr_commentcnt]) {
$list[$i][commentcnt] = "($row[wr_commentcnt])";
}
수정후 :
$list[$i][commentcnt] = "";
if ($row[wr_commentcnt]) {
$comment_count = get_comment_count(24,$bo_table,$row[wr_id],$row[wr_commentcnt]);
$list[$i][commentcnt] = $comment_count;
//$list[$i][commentcnt] = "($row[wr_commentcnt])"; // 원본 주석처리
}
ps. 2,3에서 get_comment_time(24,$bo_table,$row[wr_id],$row[wr_commentcnt]) 호출시 24라는것이 있는데
이것이 시간설정임, 만약 12시간으로 하고싶으면 12로 수정하면됨.
이버젼은 그누보드가 패치될때마다 수정하셔야 되는것입니다.
1. 다음 내용을 lib/developer.lib.php에 추가한다.
// 코멘트에서 "(특정시간내 갯수/전체코멘트수)" 구하기
function get_comment_count($hours,$bo_table,$wrid, $wrcommentcnt)
{
global $cfg;
$intime = date("Y-m-d H:i:s", time() - (int)(60 * 60 * $hours));
$sql2 = " select count(wr_datetime)
from {$cfg[write_table_prefix]}{$bo_table}
where wr_parent_id = $wrid
and wr_commentcnt = 0
and wr_datetime >= '$intime' ";
$result2 = sql_fetch($sql2);
if($result2[0] > 0) {
$retstr = "($result2[0]/$wrcommentcnt)";
} else {
$retstr = "($wrcommentcnt)";
}
return $retstr;
}
2. 최신글에서 적용하기..(그누보드가 패치되면 수정해야함)
수정파일 : lib/latest.lib.php
수정전 :
// 코멘트 카운트
$list[$i][commentcnt] = "";
if ($row[wr_commentcnt] > 0) {
$list[$i][commentcnt] = "($row[wr_commentcnt])";
}
수정후 :
// 코멘트 카운트
$list[$i][commentcnt] = "";
if ($row[wr_commentcnt] > 0) {
$comment_count = get_comment_count(24,$bo_table,$row[wr_id],$row[wr_commentcnt]);
$list[$i][commentcnt] = $comment_count;
//$list[$i][commentcnt] = "($row[wr_commentcnt])"; // 원본 주석처리
}
3. 게시판에 적용하기..(그누보드가 패치되면 수정해야함)
수정파일 : bbs/gblist.php
수정전 :
$list[$i][commentcnt] = "";
if ($row[wr_commentcnt]) {
$list[$i][commentcnt] = "($row[wr_commentcnt])";
}
수정후 :
$list[$i][commentcnt] = "";
if ($row[wr_commentcnt]) {
$comment_count = get_comment_count(24,$bo_table,$row[wr_id],$row[wr_commentcnt]);
$list[$i][commentcnt] = $comment_count;
//$list[$i][commentcnt] = "($row[wr_commentcnt])"; // 원본 주석처리
}
ps. 2,3에서 get_comment_time(24,$bo_table,$row[wr_id],$row[wr_commentcnt]) 호출시 24라는것이 있는데
이것이 시간설정임, 만약 12시간으로 하고싶으면 12로 수정하면됨.
추천
0
0
댓글 전체