그누보드 4.0 - 최신 코멘트 (최근 덧글) 추출 표시하기 정보
그누보드 4.0 - 최신 코멘트 (최근 덧글) 추출 표시하기본문
이미 올라온 팁이 아닌가 염려되네요.
그누보드 4.0 - 최신 코멘트 (최근 덧글) 추출 표시하기
1. /lib/latest.lib.php 의 하단 부분에 아래 소스를 추가하세요.
// 최신글 추출
function latest_comment($skin_dir="", $bo_table, $rows=10, $subject_len=40, $options="")
{
global $g4;
if ($skin_dir)
$latest_skin_path = "$g4[path]/skin/latest/$skin_dir";
else
$latest_skin_path = "$g4[path]/skin/latest/comment-basic-kaku";
$list = array();
$sql = " select * from $g4[board_table] where bo_table = '$bo_table'";
$board = sql_fetch($sql);
$tmp_write_table = $g4['write_prefix'] . $bo_table; // 게시판 테이블 전체이름
$sql = " select * from $tmp_write_table where wr_is_comment = 1 order by wr_id desc limit 0, $rows ";
$result = sql_query($sql);
for ($i=0; $row = sql_fetch_array($result); $i++)
{
$list[$i] = get_list($row, $board, $latest_skin_path, $subject_len);
}
ob_start();
include "$latest_skin_path/latest.skin.php";
$content = ob_get_contents();
ob_end_clean();
return $content;
}
2. /skin/latest/basic 폴더를 복사해서 /skin/latest/comment-basic-kaku
라는 이름의 새 폴더를 작성하세요.
3. /skin/latest/comment-basic-kaku 폴더에 있는 latest.skin.php 를
아래와 같이 수정하세요. (그 파일의 소스 전체 삽입했습니다... 양해를)
주의! - 저의 그누보드는 UTF-8 버전이라서 아래 소스 중에
mb_internal_encoding 를 일반 버전인 분들은 주석처리하세요.
주의! - 중간에 있는 Login Status ############# 부분은,
로그인 한 회원들에게는 코멘트가 더 자세히 보이고,
로그인 아직 안한 일반 유저들에게는 *** 처리돼서 보입니다.
적절히 수정해서 사용하시기 바랍니다.
<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
?>
<table width=100% cellpadding=0 cellspacing=0>
<colgroup width=14>
<colgroup>
<colgroup width=37>
<colgroup width=14>
<tr>
<td><img src='<?=$latest_skin_path?>/img/latest_t01.gif'></td>
<td background='<?=$latest_skin_path?>/img/bg_latest.gif'> <strong><a href='<?=$g4
[bbs_path]?>/board.php?bo_table=<?=$bo_table?>'>최신 코멘트<?// $board[bo_subject]?
></a></strong></td>
<td background='<?=$latest_skin_path?>/img/bg_latest.gif'></td>
<td><img src='<?=$latest_skin_path?>/img/latest_t02.gif'></td>
</tr>
<? for ($i=0; $i<count($list); $i++) { ?>
<tr>
<td colspan=4 align=center>
<table width="95%">
<tr>
<td valign=top><img src='<?=$latest_skin_path?>/img/co_point.gif' align=absmiddle> </td>
<td height=50 style="padding:2px">
<?
echo $list[$i]['icon_reply'] . " ";
mb_internal_encoding("UTF-8");
if ( $_SESSION['ss_mb_id'] != "" ) // Login Status #############
$strTempSubject = "<a href='{$list[$i]['comment_href']}'>".mb_substr( strip_tags( $list[$i]
['wr_content'] ), 0, $subject_len )." * * * (".mb_strlen( $list[$i]['wr_content'] )."字)</a> <br /> <p
style='margin-top: 5px;margin-bottom:2px;text-align:right'> ".$list[$i]['name'].", ".substr($list[$i]
['wr_datetime'],5,11)." </p>";
else // Not Yet Login
$strTempSubject = mb_substr( strip_tags( $list[$i]['wr_content'] ), 0, 3 )." * * * (".mb_strlen(
$list[$i]['wr_content'] )."字)";
echo "<font style='font-family:Arial; font-size:9pt; color:#6A6A6A;'>{$strTempSubject}</font>";
?></td></tr>
<tr><td colspan=2 bgcolor=#EBEBEB height=1></td></tr>
</table></td>
</tr>
<? } ?>
<? if (count($list) == 0) { ?><tr><td colspan=4 align=center height=50><font color=#6A6A6A>코멘트가 없
습니다.</a></td></tr><? } ?>
</table>
4. 최신 코멘트를 표시 원하는 메인 화면의 적당한 위치에
아래 소스를 삽입하세요.
<?
echo latest_comment( "comment-basic-kaku", "준비하신board의ID", 5, 24 );
// latest_comment("스킨디렉토리", "게시판 아이디", 출력라인수, 제목글자수)
?>
5. 메인 화면을 확인해서 이상이 없는지..
* 이상입니다.
그누보드 4.0 - 최신 코멘트 (최근 덧글) 추출 표시하기
1. /lib/latest.lib.php 의 하단 부분에 아래 소스를 추가하세요.
// 최신글 추출
function latest_comment($skin_dir="", $bo_table, $rows=10, $subject_len=40, $options="")
{
global $g4;
if ($skin_dir)
$latest_skin_path = "$g4[path]/skin/latest/$skin_dir";
else
$latest_skin_path = "$g4[path]/skin/latest/comment-basic-kaku";
$list = array();
$sql = " select * from $g4[board_table] where bo_table = '$bo_table'";
$board = sql_fetch($sql);
$tmp_write_table = $g4['write_prefix'] . $bo_table; // 게시판 테이블 전체이름
$sql = " select * from $tmp_write_table where wr_is_comment = 1 order by wr_id desc limit 0, $rows ";
$result = sql_query($sql);
for ($i=0; $row = sql_fetch_array($result); $i++)
{
$list[$i] = get_list($row, $board, $latest_skin_path, $subject_len);
}
ob_start();
include "$latest_skin_path/latest.skin.php";
$content = ob_get_contents();
ob_end_clean();
return $content;
}
2. /skin/latest/basic 폴더를 복사해서 /skin/latest/comment-basic-kaku
라는 이름의 새 폴더를 작성하세요.
3. /skin/latest/comment-basic-kaku 폴더에 있는 latest.skin.php 를
아래와 같이 수정하세요. (그 파일의 소스 전체 삽입했습니다... 양해를)
주의! - 저의 그누보드는 UTF-8 버전이라서 아래 소스 중에
mb_internal_encoding 를 일반 버전인 분들은 주석처리하세요.
주의! - 중간에 있는 Login Status ############# 부분은,
로그인 한 회원들에게는 코멘트가 더 자세히 보이고,
로그인 아직 안한 일반 유저들에게는 *** 처리돼서 보입니다.
적절히 수정해서 사용하시기 바랍니다.
<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
?>
<table width=100% cellpadding=0 cellspacing=0>
<colgroup width=14>
<colgroup>
<colgroup width=37>
<colgroup width=14>
<tr>
<td><img src='<?=$latest_skin_path?>/img/latest_t01.gif'></td>
<td background='<?=$latest_skin_path?>/img/bg_latest.gif'> <strong><a href='<?=$g4
[bbs_path]?>/board.php?bo_table=<?=$bo_table?>'>최신 코멘트<?// $board[bo_subject]?
></a></strong></td>
<td background='<?=$latest_skin_path?>/img/bg_latest.gif'></td>
<td><img src='<?=$latest_skin_path?>/img/latest_t02.gif'></td>
</tr>
<? for ($i=0; $i<count($list); $i++) { ?>
<tr>
<td colspan=4 align=center>
<table width="95%">
<tr>
<td valign=top><img src='<?=$latest_skin_path?>/img/co_point.gif' align=absmiddle> </td>
<td height=50 style="padding:2px">
<?
echo $list[$i]['icon_reply'] . " ";
mb_internal_encoding("UTF-8");
if ( $_SESSION['ss_mb_id'] != "" ) // Login Status #############
$strTempSubject = "<a href='{$list[$i]['comment_href']}'>".mb_substr( strip_tags( $list[$i]
['wr_content'] ), 0, $subject_len )." * * * (".mb_strlen( $list[$i]['wr_content'] )."字)</a> <br /> <p
style='margin-top: 5px;margin-bottom:2px;text-align:right'> ".$list[$i]['name'].", ".substr($list[$i]
['wr_datetime'],5,11)." </p>";
else // Not Yet Login
$strTempSubject = mb_substr( strip_tags( $list[$i]['wr_content'] ), 0, 3 )." * * * (".mb_strlen(
$list[$i]['wr_content'] )."字)";
echo "<font style='font-family:Arial; font-size:9pt; color:#6A6A6A;'>{$strTempSubject}</font>";
?></td></tr>
<tr><td colspan=2 bgcolor=#EBEBEB height=1></td></tr>
</table></td>
</tr>
<? } ?>
<? if (count($list) == 0) { ?><tr><td colspan=4 align=center height=50><font color=#6A6A6A>코멘트가 없
습니다.</a></td></tr><? } ?>
</table>
4. 최신 코멘트를 표시 원하는 메인 화면의 적당한 위치에
아래 소스를 삽입하세요.
<?
echo latest_comment( "comment-basic-kaku", "준비하신board의ID", 5, 24 );
// latest_comment("스킨디렉토리", "게시판 아이디", 출력라인수, 제목글자수)
?>
5. 메인 화면을 확인해서 이상이 없는지..
* 이상입니다.
추천
2
2
댓글 6개
큰 일날 뻔 했네요.
위 조치 후에, /head.php의 상단 부분에
include_once("$g4[path]/lib/latest.lib.php");
를 넣지 않으면 외부 링크에 의한 로그인시에
undefined function 에러 메시지를 볼 수도 있습니다.
꼭 챙겨 넣으세요.
위 조치 후에, /head.php의 상단 부분에
include_once("$g4[path]/lib/latest.lib.php");
를 넣지 않으면 외부 링크에 의한 로그인시에
undefined function 에러 메시지를 볼 수도 있습니다.
꼭 챙겨 넣으세요.

아직 안해봤지만 멋집니다 ㅜ...
특정 게시판 코멘트추출
코멘트
-

코멘트만 추출하는 팁 감사합니다.