r

(막코딩?)코멘트가 특정시간 이내에 작성된것 체크해보자

· 2003-12-10 (수) 16:05:32 · 2140
최신글과 리스트에서 코멘트가 특정시간 이전에 작성된것일 경우 다르게 표시하기.
이버젼은 그누보드가 패치될때마다 수정하셔야 되는것입니다.

조회하기 원하는 시간을 $hours에 설정하세요, 초기값으로 24시간(하루)가 적용되어있습니다.

1. 최신글에서 적용하기..
수정파일 : 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) {
/*************************/
// 코멘트일경우 이것이 12,24시간내인지 체크하는 루틴을 체크한다.
$hours = 24; // 원하는 시간 설정
$sql2 = " select (unix_timestamp(now()) - unix_timestamp(wr_datetime))/(60*60*$hours)
from {$cfg[write_table_prefix]}{$bo_table}
where wr_parent_id = $row[wr_id]
and wr_comment = $row[wr_commentcnt]
and wr_commentcnt = 0 ";
$result2 = sql_fetch($sql2);

if($result2[0] < 1) { // $hours 시간전에 올라온글
$list[$i][commentcnt] = "<font color=blue>($row[wr_commentcnt])</font>";
} else {
$list[$i][commentcnt] = "($row[wr_commentcnt])";
}
/*************************/
//$list[$i][commentcnt] = "($row[wr_commentcnt])"; // 원본 주석처리
}

2. 게시판에 적용하기..
수정파일 : bbs/gblist.php
수정전 :
$list[$i][commentcnt] = "";
if ($row[wr_commentcnt]) {
$list[$i][commentcnt] = "($row[wr_commentcnt])";
}
수정후 :
$list[$i][commentcnt] = "";
if ($row[wr_commentcnt]) {
/*************************/
// 코멘트일경우 이것이 12,24시간내인지 체크하는 루틴을 체크한다.
$hours = 24; // 원하는 시간 설정
$sql2 = " select (unix_timestamp(now()) - unix_timestamp(wr_datetime))/(60*60*$hours)
from {$cfg[write_table_prefix]}{$bo_table}
where wr_parent_id = $row[wr_id]
and wr_comment = $row[wr_commentcnt]
and wr_commentcnt = 0 ";
$result2 = sql_fetch($sql2);

if($result2[0] < 1) { // $hours 시간전에 올라온글
$list[$i][commentcnt] = "<font color=blue>($row[wr_commentcnt])</font>";
} else {
$list[$i][commentcnt] = "($row[wr_commentcnt])";
}
/*************************/
//$list[$i][commentcnt] = "($row[wr_commentcnt])"; // 원본 주석처리
}
|
댓글을 작성하시려면 로그인이 필요합니다.

그누3 팁자료실

1,026건
+
제목 글쓴이 날짜 조회
03-12-10 조회 1,906
03-12-10 조회 2,141
03-12-10 조회 1,949
03-12-10 조회 2,121
03-12-08 조회 2,681
03-12-07 조회 2,523
03-12-07 조회 5,689
&&nbsp;&nbsp;
03-12-07 조회 2,261
&&nbsp;&nbsp;
03-12-07 조회 2,277
&&nbsp;&nbsp;
03-12-07 조회 2,037
03-12-06 조회 3,482
03-12-05 조회 2,245
&&nbsp;&nbsp;
03-12-05 조회 2,104
03-12-05 조회 5,287
03-12-05 조회 2,083
03-12-03 조회 2,757
03-12-03 조회 2,303
03-12-02 조회 1,833
03-12-01 조회 1,934
03-11-30 조회 2,354