리스트에서 순차적인 번호처리를 부탁합니다. 정보
리스트에서 순차적인 번호처리를 부탁합니다.본문
넙순님의 내가 쓴글에 최신 코멘트, 댓글 확인 리스트 스킨
http://www.sir.co.kr/bbs/tb.php/g4_skin/73940/0f8a09e2af656d7b893694845f22ff81 을 응용하여
테이블도 넣고 전체코멘트를 뽑는 스킨을 만들었습니다.
근데 번호처리가 잘안되네요.
페이지별로 1,2,3...30, 1,2,3,...30, 1,2,3,...30, 이런 식으로 되는데,
이것을 페이지가 넘어가더라도 1,2,3...30, 31,32,33,...60, 61,62,63,...90, 이렇게 하고 싶습니다.
어떻게 해야 할까요?
<?
include_once("./_common.php");
include_once("$g4[path]/lib/latest.lib.php");
// 비회원 접근제한
if (!$member[mb_id]) {
alert("접근 권한이 없습니다.\\n\\n회원이시라면 로그인 후 이용해 보십시오.", "./login.php?wr_id=$wr_id{$qstr}&url=".urlencode("./mylist.php"));
}
$g4[title] = "전체 게시물 코멘트 확인";
include_once("./_head.php");
if (!$my_date) $my_date = "60"; // 아무런 입력이 없으면 최근 30일로...
$new_icon = 3; // 뉴 아이콘 생성 기간 설정
$rows = 30; // 페이지 목록수 지정
// 현재 페이지 로딩할때 마다 write_mb_id 필드에 코멘트글일 경우 원본글의 작성자 id값을 등록해준다.
// 코멘트 입력시 마다 서버에 저장하는 방식을 취할수도 있다.
$sqlc = " SELECT * from $g4[board_new_table] WHERE wr_id <> wr_parent AND write_mb_id = ''";
$resultc = mysql_query($sqlc);
for ($i=0; $rowc = sql_fetch_array($resultc); $i++){
$sql8 = "SELECT * from $g4[write_prefix]$rowc[bo_table] where wr_id = '$rowc[wr_parent]' ";
$row8 = sql_fetch($sql8);
if ($row8[wr_is_comment] == '0') { // 코멘트가 아닌경우
sql_fetch(" UPDATE $g4[board_new_table] set write_mb_id = '$row8[mb_id]' where bn_id = '$rowc[bn_id]' ");
}
}
// $today = getdate();
// 30일간의 기간 설정
$before_time = date("Y-m-d H:i:s", $g4[server_time] - (86400 * $my_date));
// 최신 코멘트 new 아이콘 생성관련 기간 설정
$newicon_time = date("Y-m-d H:i:s", $g4[server_time] - (86400 * $new_icon));
$sql_common = " from $g4[board_new_table] a, $g4[board_table] b, $g4[group_table] c
where a.bo_table = b.bo_table and b.gr_id = c.gr_id and b.bo_use_search = '1'
and a.wr_id <> a.wr_parent
and a.bn_datetime > '$before_time'
ORDER BY a.bn_datetime DESC";
// 총 게시물 갯수 파악 및 페이징 사전 처리
$sqlm = " select count(*) as cnt $sql_common ";
$rowm = sql_fetch($sqlm);
$total_countm = $rowm[cnt];
$total_page = ceil($total_countm / $rows); // 전체 페이지 계산
if (!$page) $page = 1; // 페이지가 없으면 첫 페이지 (1 페이지)
$from_record = ($page - 1) * $rows; // 시작 열을 구함
$list = array();
$sql = " select a.*, b.bo_subject, c.gr_subject, c.gr_id
$sql_common
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];
$comment = "[코] ";
$comment_link = "#c_{$row[wr_id]}";
$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 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);
if($row[bn_datetime] > $newicon_time)
{ $list[$i][newicon] = "<img src='$g4[path]/skin/board/basic/img/icon_new.gif'>";
}else{ $list[$i][newicon] = ''; }
$list[$i][gr_id] = $row[gr_id];
$list[$i][bo_table] = $row[bo_table];
$list[$i][name] = $name;
$list[$i][comment] = $comment;
$list[$i][href] = "./board.php?bo_table=$row[bo_table]&wr_id=$row2[wr_id]{$comment_link}";
$list[$i][datetime] = $datetime;
$list[$i][datetime2] = $datetime2;
$list[$i][gr_subject] = $row[gr_subject];
$list[$i][bo_subject] = $row[bo_subject];
$list[$i][wr_subject] = $row2[wr_subject];
}
$write_pages = get_paging($config[cf_write_pages], $page, $total_page, "?gr_id=$gr_id&view=$view&page=");
// 최근게시물 스킨을 불러와서 처리할수도 있고 그냥 한 화일에서 처리할수도있습니다.
//$new_skin_path = "$g4[path]/skin/new/$config[cf_new_skin]";
echo "<script language=\"javascript\" src=\"$g4[path]/js/sideview.js\"></script>\n";
$color = array('#669999');
shuffle($color);
for( $i = 0; $i < 1; $i++ )
{
$ran_color = $color[$i];
}
?>
<style>
.n_title1 { font-family:굴림;돋움; font-size:9pt; color:#FFFFFF; }
.n_title2 { font-family:굴림;돋움; font-size:9pt; color:<? echo $ran_color?>; }
.line_bg {background-color: <? echo $ran_color?>; filter: Alpha(Opacity=60); -moz-opacity:0.6;}
</style>
<table width="99%" border="0" cellspacing="0" cellpadding="0"><tr><td align="center" bgcolor=#ffffff>
<table width="100%" cellspacing="0" cellpadding="0">
<tr><td width="1" height="7"><img src="$g4[path]/../../img/line_mid_p1.gif"></td>
<td background="$g4[path]/../../img/line_mid_p5.gif"></td>
<td width="1"><img src="$g4[path]/../../img/line_mid_p2.gif"></td></tr>
<tr><td background="$g4[path]/../../img/line_mid_p8.gif"></td><td bgcolor=#ffffff>
<font color='#666666'>▒ <b>최근 <?=$my_date?> 일 동안 전체 코멘트</b></font> <br>
<font color='#666666'>- 최근 <?=$my_date?> 일 동안 게시글에 달린 코멘트는 <b><font color='#555555'><?=$total_countm?></font></b> 건 입니다. </font><br>
</td><td background="$g4[path]/../../img/line_mid_p6.gif" bgcolor=#ffffff></td></tr>
<tr><td><img src="$g4[path]/../../img/line_mid_p4.gif" bgcolor=#ffffff></td>
<td width=100% background="$g4[path]/../../img/line_mid_p7.gif" bgcolor=#ffffff></td>
<td><img src="$g4[path]/../../img/line_mid_p3.gif" bgcolor=#ffffff></td></tr></table></td></tr></table>
<table width="100%" align="center" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
<tr><td>
<tr>
<td>
<table width="100%" border="0" cellpadding="0" cellspacing="5" bgcolor="#f9f9f9">
<tr>
<td bgcolor="#dddddd">
<table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
<tr>
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="5"></td>
</tr>
<tr>
<td height="100" valign="top">
<!-- 제목 시작 -->
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td colspan=5 bgcolor="#cccccc" height=1></td>
</tr>
<tr bgcolor="#ffffff">
<td align=center width="8%" height=30><b>번호</b></td>
<td align=center width="22%" height=30><b>게시판</b></td>
<td align=center width=""><b>내용</b></td>
<td align=center width="10%"><b>날짜</b></td>
<td align=center width="10%"><b>글쓴이</b></td>
</tr>
<tr>
<td colspan=5 bgcolor="#cccccc" height=1></td>
</tr>
<?
$num=0;
for ($i=0; $i<count($list); $i++)
{
$num++;
$gr_subject = cut_str($list[$i][gr_subject], 25);
$bo_subject = cut_str($list[$i][bo_subject], 25);
$wr_subject = get_text(cut_str($list[$i][wr_subject], 80));
$list[$i][name] = strip_tags($list[$i][name]);
?>
<tr bgcolor="#ffffff">
<td align=center height=25> <?=$num?> </td>
<td align=center height=25> <a href='./board.php?bo_table=<?=$list[$i][bo_table]?>' title='<?=$list[$i][bo_subject]?>'><font style='color:#CC9999;'><B><?=$bo_subject?></B></font></a></td>
<td align=left height=25> <a href='<?=$list[$i][href]?>' title='<?=$list[$i][wr_subject]?>'> <?=$list[$i][comment]?><?=$wr_subject?></a> <?=$list[$i][newicon]?></td>
<td align=center height=25> <font style='font-size:8pt;font-family:tahoma;color:#AABFEA;'> <?=$list[$i][datetime2]?></font> </td>
<td align=center height=25> <font style='font-size:8pt;font-family:tahoma;color:#0099CC; text-align=right;'> <?=$list[$i][name]?> </font> </td>
</tr>
<tr>
<td colspan="5" height="1" bgcolor="#e1e1e1"></td>
</tr>
<? } ?>
<? if ($i == 0) { ?>
<tr><td colspan="5" height=50 align=center>최근 등록된 댓글이 없습니다.</td></tr>
<? } ?>
<tr>
<td colspan="9" height="50" align="center"><?=$write_pages?></td>
</tr>
</table>
</td>
</tr>
<tr>
<td height="3"></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
<?
include_once("$g4[path]/tail.php");
?>
http://www.sir.co.kr/bbs/tb.php/g4_skin/73940/0f8a09e2af656d7b893694845f22ff81 을 응용하여
테이블도 넣고 전체코멘트를 뽑는 스킨을 만들었습니다.
근데 번호처리가 잘안되네요.
페이지별로 1,2,3...30, 1,2,3,...30, 1,2,3,...30, 이런 식으로 되는데,
이것을 페이지가 넘어가더라도 1,2,3...30, 31,32,33,...60, 61,62,63,...90, 이렇게 하고 싶습니다.
어떻게 해야 할까요?
<?
include_once("./_common.php");
include_once("$g4[path]/lib/latest.lib.php");
// 비회원 접근제한
if (!$member[mb_id]) {
alert("접근 권한이 없습니다.\\n\\n회원이시라면 로그인 후 이용해 보십시오.", "./login.php?wr_id=$wr_id{$qstr}&url=".urlencode("./mylist.php"));
}
$g4[title] = "전체 게시물 코멘트 확인";
include_once("./_head.php");
if (!$my_date) $my_date = "60"; // 아무런 입력이 없으면 최근 30일로...
$new_icon = 3; // 뉴 아이콘 생성 기간 설정
$rows = 30; // 페이지 목록수 지정
// 현재 페이지 로딩할때 마다 write_mb_id 필드에 코멘트글일 경우 원본글의 작성자 id값을 등록해준다.
// 코멘트 입력시 마다 서버에 저장하는 방식을 취할수도 있다.
$sqlc = " SELECT * from $g4[board_new_table] WHERE wr_id <> wr_parent AND write_mb_id = ''";
$resultc = mysql_query($sqlc);
for ($i=0; $rowc = sql_fetch_array($resultc); $i++){
$sql8 = "SELECT * from $g4[write_prefix]$rowc[bo_table] where wr_id = '$rowc[wr_parent]' ";
$row8 = sql_fetch($sql8);
if ($row8[wr_is_comment] == '0') { // 코멘트가 아닌경우
sql_fetch(" UPDATE $g4[board_new_table] set write_mb_id = '$row8[mb_id]' where bn_id = '$rowc[bn_id]' ");
}
}
// $today = getdate();
// 30일간의 기간 설정
$before_time = date("Y-m-d H:i:s", $g4[server_time] - (86400 * $my_date));
// 최신 코멘트 new 아이콘 생성관련 기간 설정
$newicon_time = date("Y-m-d H:i:s", $g4[server_time] - (86400 * $new_icon));
$sql_common = " from $g4[board_new_table] a, $g4[board_table] b, $g4[group_table] c
where a.bo_table = b.bo_table and b.gr_id = c.gr_id and b.bo_use_search = '1'
and a.wr_id <> a.wr_parent
and a.bn_datetime > '$before_time'
ORDER BY a.bn_datetime DESC";
// 총 게시물 갯수 파악 및 페이징 사전 처리
$sqlm = " select count(*) as cnt $sql_common ";
$rowm = sql_fetch($sqlm);
$total_countm = $rowm[cnt];
$total_page = ceil($total_countm / $rows); // 전체 페이지 계산
if (!$page) $page = 1; // 페이지가 없으면 첫 페이지 (1 페이지)
$from_record = ($page - 1) * $rows; // 시작 열을 구함
$list = array();
$sql = " select a.*, b.bo_subject, c.gr_subject, c.gr_id
$sql_common
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];
$comment = "[코] ";
$comment_link = "#c_{$row[wr_id]}";
$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 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);
if($row[bn_datetime] > $newicon_time)
{ $list[$i][newicon] = "<img src='$g4[path]/skin/board/basic/img/icon_new.gif'>";
}else{ $list[$i][newicon] = ''; }
$list[$i][gr_id] = $row[gr_id];
$list[$i][bo_table] = $row[bo_table];
$list[$i][name] = $name;
$list[$i][comment] = $comment;
$list[$i][href] = "./board.php?bo_table=$row[bo_table]&wr_id=$row2[wr_id]{$comment_link}";
$list[$i][datetime] = $datetime;
$list[$i][datetime2] = $datetime2;
$list[$i][gr_subject] = $row[gr_subject];
$list[$i][bo_subject] = $row[bo_subject];
$list[$i][wr_subject] = $row2[wr_subject];
}
$write_pages = get_paging($config[cf_write_pages], $page, $total_page, "?gr_id=$gr_id&view=$view&page=");
// 최근게시물 스킨을 불러와서 처리할수도 있고 그냥 한 화일에서 처리할수도있습니다.
//$new_skin_path = "$g4[path]/skin/new/$config[cf_new_skin]";
echo "<script language=\"javascript\" src=\"$g4[path]/js/sideview.js\"></script>\n";
$color = array('#669999');
shuffle($color);
for( $i = 0; $i < 1; $i++ )
{
$ran_color = $color[$i];
}
?>
<style>
.n_title1 { font-family:굴림;돋움; font-size:9pt; color:#FFFFFF; }
.n_title2 { font-family:굴림;돋움; font-size:9pt; color:<? echo $ran_color?>; }
.line_bg {background-color: <? echo $ran_color?>; filter: Alpha(Opacity=60); -moz-opacity:0.6;}
</style>
<table width="99%" border="0" cellspacing="0" cellpadding="0"><tr><td align="center" bgcolor=#ffffff>
<table width="100%" cellspacing="0" cellpadding="0">
<tr><td width="1" height="7"><img src="$g4[path]/../../img/line_mid_p1.gif"></td>
<td background="$g4[path]/../../img/line_mid_p5.gif"></td>
<td width="1"><img src="$g4[path]/../../img/line_mid_p2.gif"></td></tr>
<tr><td background="$g4[path]/../../img/line_mid_p8.gif"></td><td bgcolor=#ffffff>
<font color='#666666'>▒ <b>최근 <?=$my_date?> 일 동안 전체 코멘트</b></font> <br>
<font color='#666666'>- 최근 <?=$my_date?> 일 동안 게시글에 달린 코멘트는 <b><font color='#555555'><?=$total_countm?></font></b> 건 입니다. </font><br>
</td><td background="$g4[path]/../../img/line_mid_p6.gif" bgcolor=#ffffff></td></tr>
<tr><td><img src="$g4[path]/../../img/line_mid_p4.gif" bgcolor=#ffffff></td>
<td width=100% background="$g4[path]/../../img/line_mid_p7.gif" bgcolor=#ffffff></td>
<td><img src="$g4[path]/../../img/line_mid_p3.gif" bgcolor=#ffffff></td></tr></table></td></tr></table>
<table width="100%" align="center" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
<tr><td>
<tr>
<td>
<table width="100%" border="0" cellpadding="0" cellspacing="5" bgcolor="#f9f9f9">
<tr>
<td bgcolor="#dddddd">
<table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
<tr>
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="5"></td>
</tr>
<tr>
<td height="100" valign="top">
<!-- 제목 시작 -->
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td colspan=5 bgcolor="#cccccc" height=1></td>
</tr>
<tr bgcolor="#ffffff">
<td align=center width="8%" height=30><b>번호</b></td>
<td align=center width="22%" height=30><b>게시판</b></td>
<td align=center width=""><b>내용</b></td>
<td align=center width="10%"><b>날짜</b></td>
<td align=center width="10%"><b>글쓴이</b></td>
</tr>
<tr>
<td colspan=5 bgcolor="#cccccc" height=1></td>
</tr>
<?
$num=0;
for ($i=0; $i<count($list); $i++)
{
$num++;
$gr_subject = cut_str($list[$i][gr_subject], 25);
$bo_subject = cut_str($list[$i][bo_subject], 25);
$wr_subject = get_text(cut_str($list[$i][wr_subject], 80));
$list[$i][name] = strip_tags($list[$i][name]);
?>
<tr bgcolor="#ffffff">
<td align=center height=25> <?=$num?> </td>
<td align=center height=25> <a href='./board.php?bo_table=<?=$list[$i][bo_table]?>' title='<?=$list[$i][bo_subject]?>'><font style='color:#CC9999;'><B><?=$bo_subject?></B></font></a></td>
<td align=left height=25> <a href='<?=$list[$i][href]?>' title='<?=$list[$i][wr_subject]?>'> <?=$list[$i][comment]?><?=$wr_subject?></a> <?=$list[$i][newicon]?></td>
<td align=center height=25> <font style='font-size:8pt;font-family:tahoma;color:#AABFEA;'> <?=$list[$i][datetime2]?></font> </td>
<td align=center height=25> <font style='font-size:8pt;font-family:tahoma;color:#0099CC; text-align=right;'> <?=$list[$i][name]?> </font> </td>
</tr>
<tr>
<td colspan="5" height="1" bgcolor="#e1e1e1"></td>
</tr>
<? } ?>
<? if ($i == 0) { ?>
<tr><td colspan="5" height=50 align=center>최근 등록된 댓글이 없습니다.</td></tr>
<? } ?>
<tr>
<td colspan="9" height="50" align="center"><?=$write_pages?></td>
</tr>
</table>
</td>
</tr>
<tr>
<td height="3"></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
<?
include_once("$g4[path]/tail.php");
?>
댓글 전체

보시기에 몇줄 안되 보이는 아주 사소한 소스코드 겠지만
만드는내내 심혈을 기울여 작업한 입장에서, 그것도 오늘 새벽에 처음 공개한 스킨을
버젓이 질문답변란에 공개해버리는것은 기분이 언짢네요.
만드는내내 심혈을 기울여 작업한 입장에서, 그것도 오늘 새벽에 처음 공개한 스킨을
버젓이 질문답변란에 공개해버리는것은 기분이 언짢네요.
죄송합니다. 스킨자료실에 공개된 것은 질문해도 되는줄 알았습니다.
개인적인 용도로 사용하려고 수정을 하였는데 대단히 죄송합니다.
어찌해야할까요. 관리자님 이거보시면 삭제부탁드립니다.
개인적인 용도로 사용하려고 수정을 하였는데 대단히 죄송합니다.
어찌해야할까요. 관리자님 이거보시면 삭제부탁드립니다.

음..서로 합의보세요^^