[허접팁] 최근게시물 형식의 단일게시판 최근코멘트 정보
[허접팁] 최근게시물 형식의 단일게시판 최근코멘트
본문
제가 필요해서 만들었습니다.
new.php에서는 코멘트 내용이나오지 않고.. 게시물의 제목만 나오므로서 어떠한 코멘트인지 알 수 없기에.. 코멘트 내용도 나오도록만든 소스입니다.
bbs폴더에 있는 new.php을 수정하여 만든 소스로 comment.php로 저장하고..
new스킨폴더에 comment.skin.php로 스킨을 꾸미시면됩니다.
php 초짜라 필요없는 소스가 막섞여 있고..
그룹별 기능이 아닌 단일 게시판에서만 코멘트를 불러 올 수 있습니다.
게시판 지정은 소스상단에 있는..
=================================================================================
$bo_table = "board"; //게시판 지정
=================================================================================
에서 지정하세요...
수정할 내용이 많은 소스입니다만.....
여튼 짜집기한 성의라도.. ㅠㅁㅠ
아래 comment.php 소스 전문..
=================================================================================
<?
include_once("./_common.php");
$g4[title] = "최근 코멘트";
include_once("./_head.php");
$bo_table = "board"; //게시판 지정
$sql_common = " from $g4[board_new_table] where bo_table='$bo_table'";
$sql_common .= " and wr_id <> wr_parent ";
if ($mb_id)
$sql_common .= " and mb_id = '$mb_id' ";
$sql_order = " order by bn_id desc ";
$sql = " select count(*) as cnt $sql_common ";
$row = sql_fetch($sql);
$total_count = $row[cnt];
$rows = $config[cf_new_rows];
$total_page = ceil($total_count / $rows); // 전체 페이지 계산
if (!$page) $page = 1; // 페이지가 없으면 첫 페이지 (1 페이지)
$from_record = ($page - 1) * $rows; // 시작 열을 구함
$list = array();
$sql = " select *
$sql_common
$sql_order
limit $from_record, $rows ";
$result = sql_query($sql);
for ($i=0; $row=sql_fetch_array($result); $i++)
{
$tmp_write_table = $g4[write_prefix] . $row[bo_table];
if ($row[wr_id] == $row[wr_parent]) // 원글
{
$row2 = sql_fetch(" select * from $tmp_write_table where wr_id = '$row[wr_id]' ");
$list[$i] = $row2;
$name = get_sideview($row2[mb_id], cut_str($row2[wr_name], $config[cf_cut_name]), $row2[wr_email], $row2[wr_homepage]);
// 당일인 경우 시간으로 표시함
$datetime = substr($row2[wr_datetime],0,10);
$datetime2 = $row2[wr_datetime];
if ($datetime == $g4[time_ymd])
$datetime2 = substr($datetime2,11,5);
else
$datetime2 = substr($datetime2,5,5);
}
else // 코멘트
{
$row2 = sql_fetch(" select * from $tmp_write_table where wr_id = '$row[wr_parent]' ");
$row3 = sql_fetch(" select mb_id, wr_name, wr_email, wr_homepage, wr_datetime, wr_content from $tmp_write_table where wr_id = '$row[wr_id]' ");
$list[$i] = $row2;
$list[$i][mb_id] = $row3[mb_id];
$list[$i][wr_name] = $row3[wr_name];
$list[$i][wr_email] = $row3[wr_email];
$list[$i][wr_homepage] = $row3[wr_homepage];
$name = get_sideview($row3[mb_id], cut_str($row3[wr_name], $config[cf_cut_name]), $row3[wr_email], $row3[wr_homepage]);
// 당일인 경우 시간으로 표시함
$datetime = substr($row3[wr_datetime],0,10);
$datetime2 = $row3[wr_datetime];
if ($datetime == $g4[time_ymd])
$datetime2 = substr($datetime2,11,5);
else
$datetime2 = substr($datetime2,5,5);
}
$list[$i][name] = $name;
$list[$i][href] = "./board.php?bo_table=$row[bo_table]&wr_id=$row2[wr_id]";
$list[$i][href2] = "./board.php?bo_table=$row[bo_table]&wr_id=$row2[wr_id]#c_{$row[wr_id]}";
$list[$i][datetime] = $datetime;
$list[$i][datetime2] = $datetime2;
$list[$i][bo_subject] = $row[bo_subject];
$list[$i][wr_subject] = $row2[wr_subject];
$list[$i][wr_content2] = $row3[wr_content];
}
$write_pages = get_paging($config[cf_write_pages], $page, $total_page, "?mb_id=$mb_id&page=");
$new_skin_path = "$g4[path]/skin/new/$config[cf_new_skin]";
echo "<script language=\"javascript\" src=\"$g4[path]/js/sideview.js\"></script>\n";
include_once("$new_skin_path/comment.skin.php");
include_once("./_tail.php");
?>
=================================================================================
오늘은 이거만 올리고 냅다 팁니다.
new.php에서는 코멘트 내용이나오지 않고.. 게시물의 제목만 나오므로서 어떠한 코멘트인지 알 수 없기에.. 코멘트 내용도 나오도록만든 소스입니다.
bbs폴더에 있는 new.php을 수정하여 만든 소스로 comment.php로 저장하고..
new스킨폴더에 comment.skin.php로 스킨을 꾸미시면됩니다.
php 초짜라 필요없는 소스가 막섞여 있고..
그룹별 기능이 아닌 단일 게시판에서만 코멘트를 불러 올 수 있습니다.
게시판 지정은 소스상단에 있는..
=================================================================================
$bo_table = "board"; //게시판 지정
=================================================================================
에서 지정하세요...
수정할 내용이 많은 소스입니다만.....
여튼 짜집기한 성의라도.. ㅠㅁㅠ
아래 comment.php 소스 전문..
=================================================================================
<?
include_once("./_common.php");
$g4[title] = "최근 코멘트";
include_once("./_head.php");
$bo_table = "board"; //게시판 지정
$sql_common = " from $g4[board_new_table] where bo_table='$bo_table'";
$sql_common .= " and wr_id <> wr_parent ";
if ($mb_id)
$sql_common .= " and mb_id = '$mb_id' ";
$sql_order = " order by bn_id desc ";
$sql = " select count(*) as cnt $sql_common ";
$row = sql_fetch($sql);
$total_count = $row[cnt];
$rows = $config[cf_new_rows];
$total_page = ceil($total_count / $rows); // 전체 페이지 계산
if (!$page) $page = 1; // 페이지가 없으면 첫 페이지 (1 페이지)
$from_record = ($page - 1) * $rows; // 시작 열을 구함
$list = array();
$sql = " select *
$sql_common
$sql_order
limit $from_record, $rows ";
$result = sql_query($sql);
for ($i=0; $row=sql_fetch_array($result); $i++)
{
$tmp_write_table = $g4[write_prefix] . $row[bo_table];
if ($row[wr_id] == $row[wr_parent]) // 원글
{
$row2 = sql_fetch(" select * from $tmp_write_table where wr_id = '$row[wr_id]' ");
$list[$i] = $row2;
$name = get_sideview($row2[mb_id], cut_str($row2[wr_name], $config[cf_cut_name]), $row2[wr_email], $row2[wr_homepage]);
// 당일인 경우 시간으로 표시함
$datetime = substr($row2[wr_datetime],0,10);
$datetime2 = $row2[wr_datetime];
if ($datetime == $g4[time_ymd])
$datetime2 = substr($datetime2,11,5);
else
$datetime2 = substr($datetime2,5,5);
}
else // 코멘트
{
$row2 = sql_fetch(" select * from $tmp_write_table where wr_id = '$row[wr_parent]' ");
$row3 = sql_fetch(" select mb_id, wr_name, wr_email, wr_homepage, wr_datetime, wr_content from $tmp_write_table where wr_id = '$row[wr_id]' ");
$list[$i] = $row2;
$list[$i][mb_id] = $row3[mb_id];
$list[$i][wr_name] = $row3[wr_name];
$list[$i][wr_email] = $row3[wr_email];
$list[$i][wr_homepage] = $row3[wr_homepage];
$name = get_sideview($row3[mb_id], cut_str($row3[wr_name], $config[cf_cut_name]), $row3[wr_email], $row3[wr_homepage]);
// 당일인 경우 시간으로 표시함
$datetime = substr($row3[wr_datetime],0,10);
$datetime2 = $row3[wr_datetime];
if ($datetime == $g4[time_ymd])
$datetime2 = substr($datetime2,11,5);
else
$datetime2 = substr($datetime2,5,5);
}
$list[$i][name] = $name;
$list[$i][href] = "./board.php?bo_table=$row[bo_table]&wr_id=$row2[wr_id]";
$list[$i][href2] = "./board.php?bo_table=$row[bo_table]&wr_id=$row2[wr_id]#c_{$row[wr_id]}";
$list[$i][datetime] = $datetime;
$list[$i][datetime2] = $datetime2;
$list[$i][bo_subject] = $row[bo_subject];
$list[$i][wr_subject] = $row2[wr_subject];
$list[$i][wr_content2] = $row3[wr_content];
}
$write_pages = get_paging($config[cf_write_pages], $page, $total_page, "?mb_id=$mb_id&page=");
$new_skin_path = "$g4[path]/skin/new/$config[cf_new_skin]";
echo "<script language=\"javascript\" src=\"$g4[path]/js/sideview.js\"></script>\n";
include_once("$new_skin_path/comment.skin.php");
include_once("./_tail.php");
?>
=================================================================================
오늘은 이거만 올리고 냅다 팁니다.
추천
1
1
댓글 4개
수고 많으셨습니다. ㅎ
저는 긁어서 3=3=3=3=3=3
저는 긁어서 3=3=3=3=3=3

감사합니다. ^^ 그누 게시판 하나를 블로그처럼 일기를 쓰고 있는데..... 이게 딱 원하던 팁입니다. ^^
엇 완전 제가 찾던겁니다. 꺅 치에님 감사드려요
comment.php 파일은 어디다 저장해야 하고 적용시켜야 하나요?