게시판 목록 순서바꾸기 - 최근게시물 정보
게시판 목록 순서바꾸기 - 최근게시물본문
http://sir.co.kr/bbs/board.php?bo_table=g4_skin&wr_id=81381
송이씨닷컴님의 "직원소개,회원프로필, 위치변경가능.."스킨을 수정해서 작업하고 있습니다.
게시물 목록들을 "▲ , ▼" 버튼을 통해 서로 순서를 바꾸도록 만드는데,
게시판목록에서는 작동하도록 완료하였습니다.
그런데 최근게시물에서도 순서 변경이 가능하도록 해야해서요.
게시판경로를 최근게시물 경로로 바꿔서 수정해보았습니다.
그것만으로는 적용 되지 않네요.
조언 부탁드립니다!
바로아래는 최근게시물에 들어간 관련 코드입니다.
<script language="JavaScript">
function rank(mode,wr_id,rank){
hfrm.location.href="<?=$latest_skin_path?>/rank_update.php?bo_table=<?=$bo_table?>&mode="+mode+"&wr_id="+wr_id;
}
</script>
<a style=padding-bottom:5px; href="javascript:rank('up','<?=$list[$i][wr_id]?>')"><img src="<?=$latest_skin_path?>/img/left.gif" alt='한칸위로'></a>
<a href="javascript:rank('down','<?=$list[$i][wr_id]?>')"><img src="<?=$latest_skin_path?>/img/right.gif" alt='한칸아래로'></a>
<iframe name="hfrm" id="hfrm" frameborder="0" marginwidth="0" marginheight="0" width="0" height="0"></iframe>
아래는 스크립트 작동시 실행되는 php파일 코드입니다.
<?
/*-------------------------------------------
by 송이씨닷컴 2009.06.12 / http://song2c.com
(개발자정보 삭제,수정금지)
--------------------------------------------*/
include_once('./_common.php');
if(!$is_admin) exit;
$table = $g4['write_prefix'].$_GET['bo_table'];
$inqty1 = ($_GET['mode']=="up")? ">" : "<";
$inqty2 = ($_GET['mode']=="up")? "asc" : "desc";
$inqty3 = ($_GET['mode']=="up")? "최상위" : "최하위";
// MY ROW
$sel_my = sql_query("select * from $table where wr_id={$_GET[wr_id]}");
$my = sql_fetch_array($sel_my);
// TARGET ROW
$sel_target = sql_query("select * from $table where wr_id{$inqty1}{$_GET[wr_id]} order by wr_id {$inqty2} limit 1");
$target = sql_fetch_array($sel_target);
if($target['wr_id']){
//my 넘버를 임시로 바꾼후, target 넘버를 my로, my 넘버를 target으로..
sql_query("update $table set wr_id=99999, wr_num=99999, wr_parent=99999 where wr_id={$my[wr_id]} ");
sql_query("update $table set wr_id={$my[wr_id]}, wr_num={$my[wr_num]}, wr_parent={$my[wr_parent]} where wr_id={$target[wr_id]} ");
sql_query("update $table set wr_id={$target[wr_id]}, wr_num={$target[wr_num]}, wr_parent={$target[wr_parent]} where wr_id=99999 ");
//my 파일테이블도 마찬가지로 바꿈
sql_query("update {$g4[board_file_table]} set wr_id=99999 where bo_table='{$_GET[bo_table]}' and wr_id={$my[wr_id]}");
sql_query("update {$g4[board_file_table]} set wr_id={$my[wr_id]} where bo_table='{$_GET[bo_table]}' and wr_id={$target[wr_id]}");
sql_query("update {$g4[board_file_table]} set wr_id={$target[wr_id]} where bo_table='{$_GET[bo_table]}' and wr_id=99999");
//echo "<script type='text/javascript'>alert('변경되었습니다');</script>";
echo "<script type='text/javascript'>top.location.replace('$g4[bbs_path]/board.php?bo_table=$_GET[bo_table]');</script>";
}else{
echo "<script type='text/javascript'>alert('현재 {$inqty3}입니다.');</script>";
}
exit;
?>
▼ 자세한 코드들
============ latest.skin.php ============
<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
if($list[$i]['icon_new']) $img = "icn_new.gif";
else $img = "icn_arr.gif";
$cols = 4; // 이미지 가로갯수 // 이미지 세로 갯수는 메인에서 지정(총 이미지 수)
$imgwidth=150; //표시할 이미지의 가로사이즈
$imgheight=112; //표시할 이미지의 세로사이즈
$image_h = 5; // 이미지 상하 간격
$col_width = (int)(100 / $cols);
$data_path = $g4[path]."/data/file/$bo_table";
?>
<!-- 목록순서 변경 -->
<script language="JavaScript">
function rank(mode,wr_id,rank){
hfrm.location.href="<?=$latest_skin_path?>/rank_update.php?bo_table=<?=$bo_table?>&mode="+mode+"&wr_id="+wr_id;
}
</script>
<!-- 목록순서 변경 -->
<style type="text/css">
*{font-family:나눔고딕;}
</style>
<table width="100%" border="0" cellspacing="0" cellpadding="0" style="margin-top:20px;">
<tr>
<td height="5"><!--여백--></td>
</tr>
<tr>
<td align="center" valign="top">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<? for ($i=0; $i<count($list); $i++) {
if ($i>0 && $i%$cols==0) { echo "</tr><tr><td colspan='$cols' height='$image_h'></td></tr><tr>"; }
?>
<?
$p_six = explode("|",$list[$i]['wr_6']);
$six01 = $p_six[0];
$six02 = $p_six[1];
$six03 = $p_six[2];
$six04 = $p_six[3];
$six05 = $p_six[4];
$six06 = $p_six[5];
$six07 = $p_six[6];
$six08 = $p_six[7];
$six09 = $p_six[8];
$six10 = $p_six[9];
$six11 = $p_six[10];
$six12 = $p_six[11];
$six13 = $p_six[12];
$six14 = $p_six[13];
$six15 = $p_six[14];
$six16 = $p_six[15];
$six17 = $p_six[16];
$six18 = $p_six[17];
$six19 = $p_six[18];
$six20 = $p_six[19];
$six21 = $p_six[20];
$six22 = $p_six[21];
$six23 = $p_six[22];
$six24 = $p_six[23];
$six25 = $p_six[24];
$six26 = $p_six[25];
$six27 = $p_six[26];
$six28 = $p_six[27];
$six29 = $p_six[28];
$six30 = $p_six[29];
?>
<td width="<?=$col_width?>%" align="center" valign="top">
<?
$image = $list[$i][file][0][file]; //원본
$img=$data_path. "/".$image; //썸네일이 없을경우 원본출력
if(!is_file($img)) $img="$latest_skin_path//img/no_image.gif";
$pyeong1 = number_format(($six10 / 3.305785),0);
$pyeong2 = number_format(($six12 / 3.305785),0);
$price = number_format($six01);
$month = number_format($six04);
echo $list[$i][icon_reply] . " ";
echo "<table width='100%' cellpadding='0' cellspacing='0' border='0' style='font-weight:bold;'>";
echo "<tr><td valign='top' align='center'><a href='{$list[$i]['href']}'><img src='$img' width='{$imgwidth}' height='{$imgheight}' align='center' style='width:{$imgwidth}px;height:{$imgheight}px;border:1px solid #CECECE; margin-bottom:5px; padding:5px; box-shadow:0px 0px 3px #999;'></a></td></tr>";
echo "<tr><td align='left'><a href='{$list[$i]['href']}'><span style='padding-left:10px;color:#000; '><b>[{$list[$i]['subject']}]</b></span></a></td></tr>";
echo "<tr><td align='left'><a href='{$list[$i]['href']}'><span style='color:#CC3300;padding-left:10px;'>{$list[$i][wr_1]} {$list[$i][wr_2]}</span></a></td></tr>";
echo "<tr><td align='left'><a href='{$list[$i]['href']}'><span style='color:#0e5984;padding-left:10px;'>{$six10}m<sup style='font-size:8px;'>2</sup>/ {$six12}m<sup style='font-size:8px;'>2</sup></span></a></td></tr>";
echo "<tr><td align='left'><a href='{$list[$i]['href']}'><span style='color:#0e5984;padding-left:10px;'>{$pyeong1}평 / {$pyeong2}평</span></a></td></tr>";
echo "<tr><td align='left'><a href='{$list[$i]['href']}'><span style='color:#FF6600;padding-left:10px;'>{$price} 만원";
if($six04 > 0) echo " (월 {$month} 만원)";
echo "</span></a></td></tr>";
echo "<tr><td align='left'><a href='{$list[$i]['href']}'><span style='color:#0099FF;padding-left:10px;'>";
if ($list[$i][wr_4] == "매매")
echo "<img src='$latest_skin_path/img/bicon_02.gif' border='0' align='absmiddle'>";
if ($list[$i][wr_4] == "임대")
echo "<img src='$latest_skin_path/img/bicon_01.gif' border='0' align='absmiddle'>";
echo " {$list[$i][wr_21]}</span></a>";?>
<a style=padding-bottom:5px; href="javascript:rank('up','<?=$list[$i][wr_id]?>')"><img src="<?=$latest_skin_path?>/img/left.gif" alt='한칸위로'></a>
<a href="javascript:rank('down','<?=$list[$i][wr_id]?>')"><img src="<?=$latest_skin_path?>/img/right.gif" alt='한칸아래로'></a>
<?
echo "</td></tr>";
echo "<tr><td align='left'> </td></tr>";
echo "</table>";
?>
</td>
<? } ?>
<?
$cnt = ($i%$cols);
for ($k=$cnt; $k<$cols && $cnt; $k++) {
echo "<td width=$col_width%></td>";
}
?>
<? if (count($list) == 0) { echo "<td align=center>게시물이 없습니다.</td>"; } ?>
</tr>
</table>
</td>
</tr>
</table>
<iframe name="hfrm" id="hfrm" frameborder="0" marginwidth="0" marginheight="0" width="0" height="0"></iframe>
============ rank_update.php ============
<?
/*-------------------------------------------
by 송이씨닷컴 2009.06.12 / http://song2c.com
(개발자정보 삭제,수정금지)
--------------------------------------------*/
include_once('./_common.php');
if(!$is_admin) exit;
$table = $g4['write_prefix'].$_GET['bo_table'];
$inqty1 = ($_GET['mode']=="up")? ">" : "<";
$inqty2 = ($_GET['mode']=="up")? "asc" : "desc";
$inqty3 = ($_GET['mode']=="up")? "최상위" : "최하위";
// MY ROW
$sel_my = sql_query("select * from $table where wr_id={$_GET[wr_id]}");
$my = sql_fetch_array($sel_my);
// TARGET ROW
$sel_target = sql_query("select * from $table where wr_id{$inqty1}{$_GET[wr_id]} order by wr_id {$inqty2} limit 1");
$target = sql_fetch_array($sel_target);
if($target['wr_id']){
//my 넘버를 임시로 바꾼후, target 넘버를 my로, my 넘버를 target으로..
sql_query("update $table set wr_id=99999, wr_num=99999, wr_parent=99999 where wr_id={$my[wr_id]} ");
sql_query("update $table set wr_id={$my[wr_id]}, wr_num={$my[wr_num]}, wr_parent={$my[wr_parent]} where wr_id={$target[wr_id]} ");
sql_query("update $table set wr_id={$target[wr_id]}, wr_num={$target[wr_num]}, wr_parent={$target[wr_parent]} where wr_id=99999 ");
//my 파일테이블도 마찬가지로 바꿈
sql_query("update {$g4[board_file_table]} set wr_id=99999 where bo_table='{$_GET[bo_table]}' and wr_id={$my[wr_id]}");
sql_query("update {$g4[board_file_table]} set wr_id={$my[wr_id]} where bo_table='{$_GET[bo_table]}' and wr_id={$target[wr_id]}");
sql_query("update {$g4[board_file_table]} set wr_id={$target[wr_id]} where bo_table='{$_GET[bo_table]}' and wr_id=99999");
//echo "<script type='text/javascript'>alert('변경되었습니다');</script>";
echo "<script type='text/javascript'>top.location.replace('$g4[bbs_path]/board.php?bo_table=$_GET[bo_table]');</script>";
}else{
echo "<script type='text/javascript'>alert('현재 {$inqty3}입니다.');</script>";
}
exit;
?>
송이씨닷컴님의 "직원소개,회원프로필, 위치변경가능.."스킨을 수정해서 작업하고 있습니다.
게시물 목록들을 "▲ , ▼" 버튼을 통해 서로 순서를 바꾸도록 만드는데,
게시판목록에서는 작동하도록 완료하였습니다.
그런데 최근게시물에서도 순서 변경이 가능하도록 해야해서요.
게시판경로를 최근게시물 경로로 바꿔서 수정해보았습니다.
그것만으로는 적용 되지 않네요.
조언 부탁드립니다!
바로아래는 최근게시물에 들어간 관련 코드입니다.
<script language="JavaScript">
function rank(mode,wr_id,rank){
hfrm.location.href="<?=$latest_skin_path?>/rank_update.php?bo_table=<?=$bo_table?>&mode="+mode+"&wr_id="+wr_id;
}
</script>
<a style=padding-bottom:5px; href="javascript:rank('up','<?=$list[$i][wr_id]?>')"><img src="<?=$latest_skin_path?>/img/left.gif" alt='한칸위로'></a>
<a href="javascript:rank('down','<?=$list[$i][wr_id]?>')"><img src="<?=$latest_skin_path?>/img/right.gif" alt='한칸아래로'></a>
<iframe name="hfrm" id="hfrm" frameborder="0" marginwidth="0" marginheight="0" width="0" height="0"></iframe>
아래는 스크립트 작동시 실행되는 php파일 코드입니다.
<?
/*-------------------------------------------
by 송이씨닷컴 2009.06.12 / http://song2c.com
(개발자정보 삭제,수정금지)
--------------------------------------------*/
include_once('./_common.php');
if(!$is_admin) exit;
$table = $g4['write_prefix'].$_GET['bo_table'];
$inqty1 = ($_GET['mode']=="up")? ">" : "<";
$inqty2 = ($_GET['mode']=="up")? "asc" : "desc";
$inqty3 = ($_GET['mode']=="up")? "최상위" : "최하위";
// MY ROW
$sel_my = sql_query("select * from $table where wr_id={$_GET[wr_id]}");
$my = sql_fetch_array($sel_my);
// TARGET ROW
$sel_target = sql_query("select * from $table where wr_id{$inqty1}{$_GET[wr_id]} order by wr_id {$inqty2} limit 1");
$target = sql_fetch_array($sel_target);
if($target['wr_id']){
//my 넘버를 임시로 바꾼후, target 넘버를 my로, my 넘버를 target으로..
sql_query("update $table set wr_id=99999, wr_num=99999, wr_parent=99999 where wr_id={$my[wr_id]} ");
sql_query("update $table set wr_id={$my[wr_id]}, wr_num={$my[wr_num]}, wr_parent={$my[wr_parent]} where wr_id={$target[wr_id]} ");
sql_query("update $table set wr_id={$target[wr_id]}, wr_num={$target[wr_num]}, wr_parent={$target[wr_parent]} where wr_id=99999 ");
//my 파일테이블도 마찬가지로 바꿈
sql_query("update {$g4[board_file_table]} set wr_id=99999 where bo_table='{$_GET[bo_table]}' and wr_id={$my[wr_id]}");
sql_query("update {$g4[board_file_table]} set wr_id={$my[wr_id]} where bo_table='{$_GET[bo_table]}' and wr_id={$target[wr_id]}");
sql_query("update {$g4[board_file_table]} set wr_id={$target[wr_id]} where bo_table='{$_GET[bo_table]}' and wr_id=99999");
//echo "<script type='text/javascript'>alert('변경되었습니다');</script>";
echo "<script type='text/javascript'>top.location.replace('$g4[bbs_path]/board.php?bo_table=$_GET[bo_table]');</script>";
}else{
echo "<script type='text/javascript'>alert('현재 {$inqty3}입니다.');</script>";
}
exit;
?>
▼ 자세한 코드들
============ latest.skin.php ============
<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
if($list[$i]['icon_new']) $img = "icn_new.gif";
else $img = "icn_arr.gif";
$cols = 4; // 이미지 가로갯수 // 이미지 세로 갯수는 메인에서 지정(총 이미지 수)
$imgwidth=150; //표시할 이미지의 가로사이즈
$imgheight=112; //표시할 이미지의 세로사이즈
$image_h = 5; // 이미지 상하 간격
$col_width = (int)(100 / $cols);
$data_path = $g4[path]."/data/file/$bo_table";
?>
<!-- 목록순서 변경 -->
<script language="JavaScript">
function rank(mode,wr_id,rank){
hfrm.location.href="<?=$latest_skin_path?>/rank_update.php?bo_table=<?=$bo_table?>&mode="+mode+"&wr_id="+wr_id;
}
</script>
<!-- 목록순서 변경 -->
<style type="text/css">
*{font-family:나눔고딕;}
</style>
<table width="100%" border="0" cellspacing="0" cellpadding="0" style="margin-top:20px;">
<tr>
<td height="5"><!--여백--></td>
</tr>
<tr>
<td align="center" valign="top">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<? for ($i=0; $i<count($list); $i++) {
if ($i>0 && $i%$cols==0) { echo "</tr><tr><td colspan='$cols' height='$image_h'></td></tr><tr>"; }
?>
<?
$p_six = explode("|",$list[$i]['wr_6']);
$six01 = $p_six[0];
$six02 = $p_six[1];
$six03 = $p_six[2];
$six04 = $p_six[3];
$six05 = $p_six[4];
$six06 = $p_six[5];
$six07 = $p_six[6];
$six08 = $p_six[7];
$six09 = $p_six[8];
$six10 = $p_six[9];
$six11 = $p_six[10];
$six12 = $p_six[11];
$six13 = $p_six[12];
$six14 = $p_six[13];
$six15 = $p_six[14];
$six16 = $p_six[15];
$six17 = $p_six[16];
$six18 = $p_six[17];
$six19 = $p_six[18];
$six20 = $p_six[19];
$six21 = $p_six[20];
$six22 = $p_six[21];
$six23 = $p_six[22];
$six24 = $p_six[23];
$six25 = $p_six[24];
$six26 = $p_six[25];
$six27 = $p_six[26];
$six28 = $p_six[27];
$six29 = $p_six[28];
$six30 = $p_six[29];
?>
<td width="<?=$col_width?>%" align="center" valign="top">
<?
$image = $list[$i][file][0][file]; //원본
$img=$data_path. "/".$image; //썸네일이 없을경우 원본출력
if(!is_file($img)) $img="$latest_skin_path//img/no_image.gif";
$pyeong1 = number_format(($six10 / 3.305785),0);
$pyeong2 = number_format(($six12 / 3.305785),0);
$price = number_format($six01);
$month = number_format($six04);
echo $list[$i][icon_reply] . " ";
echo "<table width='100%' cellpadding='0' cellspacing='0' border='0' style='font-weight:bold;'>";
echo "<tr><td valign='top' align='center'><a href='{$list[$i]['href']}'><img src='$img' width='{$imgwidth}' height='{$imgheight}' align='center' style='width:{$imgwidth}px;height:{$imgheight}px;border:1px solid #CECECE; margin-bottom:5px; padding:5px; box-shadow:0px 0px 3px #999;'></a></td></tr>";
echo "<tr><td align='left'><a href='{$list[$i]['href']}'><span style='padding-left:10px;color:#000; '><b>[{$list[$i]['subject']}]</b></span></a></td></tr>";
echo "<tr><td align='left'><a href='{$list[$i]['href']}'><span style='color:#CC3300;padding-left:10px;'>{$list[$i][wr_1]} {$list[$i][wr_2]}</span></a></td></tr>";
echo "<tr><td align='left'><a href='{$list[$i]['href']}'><span style='color:#0e5984;padding-left:10px;'>{$six10}m<sup style='font-size:8px;'>2</sup>/ {$six12}m<sup style='font-size:8px;'>2</sup></span></a></td></tr>";
echo "<tr><td align='left'><a href='{$list[$i]['href']}'><span style='color:#0e5984;padding-left:10px;'>{$pyeong1}평 / {$pyeong2}평</span></a></td></tr>";
echo "<tr><td align='left'><a href='{$list[$i]['href']}'><span style='color:#FF6600;padding-left:10px;'>{$price} 만원";
if($six04 > 0) echo " (월 {$month} 만원)";
echo "</span></a></td></tr>";
echo "<tr><td align='left'><a href='{$list[$i]['href']}'><span style='color:#0099FF;padding-left:10px;'>";
if ($list[$i][wr_4] == "매매")
echo "<img src='$latest_skin_path/img/bicon_02.gif' border='0' align='absmiddle'>";
if ($list[$i][wr_4] == "임대")
echo "<img src='$latest_skin_path/img/bicon_01.gif' border='0' align='absmiddle'>";
echo " {$list[$i][wr_21]}</span></a>";?>
<a style=padding-bottom:5px; href="javascript:rank('up','<?=$list[$i][wr_id]?>')"><img src="<?=$latest_skin_path?>/img/left.gif" alt='한칸위로'></a>
<a href="javascript:rank('down','<?=$list[$i][wr_id]?>')"><img src="<?=$latest_skin_path?>/img/right.gif" alt='한칸아래로'></a>
<?
echo "</td></tr>";
echo "<tr><td align='left'> </td></tr>";
echo "</table>";
?>
</td>
<? } ?>
<?
$cnt = ($i%$cols);
for ($k=$cnt; $k<$cols && $cnt; $k++) {
echo "<td width=$col_width%></td>";
}
?>
<? if (count($list) == 0) { echo "<td align=center>게시물이 없습니다.</td>"; } ?>
</tr>
</table>
</td>
</tr>
</table>
<iframe name="hfrm" id="hfrm" frameborder="0" marginwidth="0" marginheight="0" width="0" height="0"></iframe>
============ rank_update.php ============
<?
/*-------------------------------------------
by 송이씨닷컴 2009.06.12 / http://song2c.com
(개발자정보 삭제,수정금지)
--------------------------------------------*/
include_once('./_common.php');
if(!$is_admin) exit;
$table = $g4['write_prefix'].$_GET['bo_table'];
$inqty1 = ($_GET['mode']=="up")? ">" : "<";
$inqty2 = ($_GET['mode']=="up")? "asc" : "desc";
$inqty3 = ($_GET['mode']=="up")? "최상위" : "최하위";
// MY ROW
$sel_my = sql_query("select * from $table where wr_id={$_GET[wr_id]}");
$my = sql_fetch_array($sel_my);
// TARGET ROW
$sel_target = sql_query("select * from $table where wr_id{$inqty1}{$_GET[wr_id]} order by wr_id {$inqty2} limit 1");
$target = sql_fetch_array($sel_target);
if($target['wr_id']){
//my 넘버를 임시로 바꾼후, target 넘버를 my로, my 넘버를 target으로..
sql_query("update $table set wr_id=99999, wr_num=99999, wr_parent=99999 where wr_id={$my[wr_id]} ");
sql_query("update $table set wr_id={$my[wr_id]}, wr_num={$my[wr_num]}, wr_parent={$my[wr_parent]} where wr_id={$target[wr_id]} ");
sql_query("update $table set wr_id={$target[wr_id]}, wr_num={$target[wr_num]}, wr_parent={$target[wr_parent]} where wr_id=99999 ");
//my 파일테이블도 마찬가지로 바꿈
sql_query("update {$g4[board_file_table]} set wr_id=99999 where bo_table='{$_GET[bo_table]}' and wr_id={$my[wr_id]}");
sql_query("update {$g4[board_file_table]} set wr_id={$my[wr_id]} where bo_table='{$_GET[bo_table]}' and wr_id={$target[wr_id]}");
sql_query("update {$g4[board_file_table]} set wr_id={$target[wr_id]} where bo_table='{$_GET[bo_table]}' and wr_id=99999");
//echo "<script type='text/javascript'>alert('변경되었습니다');</script>";
echo "<script type='text/javascript'>top.location.replace('$g4[bbs_path]/board.php?bo_table=$_GET[bo_table]');</script>";
}else{
echo "<script type='text/javascript'>alert('현재 {$inqty3}입니다.');</script>";
}
exit;
?>
댓글 전체