게시물을 다른 게시판으로 복사시 최신글에도 나오게 하는 방법입니다
게시물을 다른 게시판으로 복사시 최신글에는 나오지 않는데 최신글에도 나올 수 있도록 하는 방법입니다.
아래 홈이네님의 자료를 수정하였습니다.
http://sir.co.kr/bbs/board.php?bo_table=g4_tiptech&wr_id=18609&sca=&sfl=wr_subject%7C%7Cwr_content&stx=%EB%B3%B5%EC%82%AC+%EC%B5%9C%EC%8B%A0%EA%B8%80
--------------------------------------------------------------------------------------
/////////////////////////////////////////////////////
// bbs/move_update.php
/////////////////////////////////////////////////////
if ($sw == "move" && $i == 0)
{
// 스크랩 이동
sql_query(" update $g5[scrap_table] set bo_table = '$move_bo_table', wr_id = '$save_parent' where bo_table = '$bo_table' and wr_id = '$row2[wr_id]' ");
// 최신글 이동
sql_query(" update $g5[board_new_table] set bo_table = '$move_bo_table', wr_id = '$save_parent', wr_parent = '$save_parent' where bo_table = '$bo_table' and wr_id = '$row2[wr_id]' ");
}
//////////////////////////////////////////////////////
// 위 소스를 아래 것으로 교체
//////////////////////////////////////////////////////
if ($sw == "move" && $i == 0)
{
// 스크랩 이동
sql_query(" update $g5[scrap_table] set bo_table = '$move_bo_table', wr_id = '$save_parent' where bo_table = '$bo_table' and wr_id = '$row2[wr_id]' ");
// 최신글 이동
sql_query(" update $g5[board_new_table] set bo_table = '$move_bo_table', wr_id = '$save_parent', wr_parent = '$save_parent' where bo_table = '$bo_table' and wr_id = '$row2[wr_id]' ");
}
else if ($sw == "copy")
{
board_new_copy($bo_table, $row2[wr_id], $move_bo_table, $save_parent);
}
======================================================================================
아래 소스를 넣은 index.php 파일을 만들어 extend 폴더에 넣는다. (파일 첨부함)
<?php
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
// 이전 게시판, 이전 게시물 번호, 저장할 게시판, 저장된 원글 게시물 번호
// 최신글 테이블 복사
// 최신글 테이블 복사
function board_new_copy($bo_table, $wr_id, $save_bo_table, $save_wr_id)
{
global $g5;
$sql = mysql_query(" select * from $g5[board_new_table]
where
bo_table = '$bo_table' and
wr_parent = '$wr_id' ");
mysql_num_rows($sql);
$num = 0;
while($row=mysql_fetch_array($sql,1))
{
$query = "";
$send_query = "";
$key = array_keys($row);
$value = array_values($row);
for ($i=0; $i<count($value); $i++)
{
if ($key[$i] == "bo_table")
$value[$i] = $save_bo_table;
// 필드가 개시물 번호라면 넘어 온 개시물 번호를 저장
if ($key[$i] == "bn_id")
$value[$i] = "";
// 코멘트번호라면 넘어 온 개시물 번호를 저장
if ($key[$i] == "wr_parent")
$value[$i] = $save_wr_id;
// 원글이고, 필드가 코멘트 번호라면 넘어온 번호 저장
if ($row[wr_id] == $row[wr_parent] && $key[$i] == "wr_id")
$value[$i] = $save_wr_id;
else if ($key[$i] == "wr_id")
{
$num++;
$value[$i] = $save_wr_id + $num;
}
if (!$query)
$query .= " $key[$i] = '$value[$i]' ";
else
$query .= " ,$key[$i] = '$value[$i]' ";
}
$send_query = " insert into $g5[board_new_table] set " . $query;
mysql_query($send_query);
}
return;
}
?>
아래 홈이네님의 자료를 수정하였습니다.
http://sir.co.kr/bbs/board.php?bo_table=g4_tiptech&wr_id=18609&sca=&sfl=wr_subject%7C%7Cwr_content&stx=%EB%B3%B5%EC%82%AC+%EC%B5%9C%EC%8B%A0%EA%B8%80
--------------------------------------------------------------------------------------
/////////////////////////////////////////////////////
// bbs/move_update.php
/////////////////////////////////////////////////////
if ($sw == "move" && $i == 0)
{
// 스크랩 이동
sql_query(" update $g5[scrap_table] set bo_table = '$move_bo_table', wr_id = '$save_parent' where bo_table = '$bo_table' and wr_id = '$row2[wr_id]' ");
// 최신글 이동
sql_query(" update $g5[board_new_table] set bo_table = '$move_bo_table', wr_id = '$save_parent', wr_parent = '$save_parent' where bo_table = '$bo_table' and wr_id = '$row2[wr_id]' ");
}
//////////////////////////////////////////////////////
// 위 소스를 아래 것으로 교체
//////////////////////////////////////////////////////
if ($sw == "move" && $i == 0)
{
// 스크랩 이동
sql_query(" update $g5[scrap_table] set bo_table = '$move_bo_table', wr_id = '$save_parent' where bo_table = '$bo_table' and wr_id = '$row2[wr_id]' ");
// 최신글 이동
sql_query(" update $g5[board_new_table] set bo_table = '$move_bo_table', wr_id = '$save_parent', wr_parent = '$save_parent' where bo_table = '$bo_table' and wr_id = '$row2[wr_id]' ");
}
else if ($sw == "copy")
{
board_new_copy($bo_table, $row2[wr_id], $move_bo_table, $save_parent);
}
======================================================================================
아래 소스를 넣은 index.php 파일을 만들어 extend 폴더에 넣는다. (파일 첨부함)
<?php
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
// 이전 게시판, 이전 게시물 번호, 저장할 게시판, 저장된 원글 게시물 번호
// 최신글 테이블 복사
// 최신글 테이블 복사
function board_new_copy($bo_table, $wr_id, $save_bo_table, $save_wr_id)
{
global $g5;
$sql = mysql_query(" select * from $g5[board_new_table]
where
bo_table = '$bo_table' and
wr_parent = '$wr_id' ");
mysql_num_rows($sql);
$num = 0;
while($row=mysql_fetch_array($sql,1))
{
$query = "";
$send_query = "";
$key = array_keys($row);
$value = array_values($row);
for ($i=0; $i<count($value); $i++)
{
if ($key[$i] == "bo_table")
$value[$i] = $save_bo_table;
// 필드가 개시물 번호라면 넘어 온 개시물 번호를 저장
if ($key[$i] == "bn_id")
$value[$i] = "";
// 코멘트번호라면 넘어 온 개시물 번호를 저장
if ($key[$i] == "wr_parent")
$value[$i] = $save_wr_id;
// 원글이고, 필드가 코멘트 번호라면 넘어온 번호 저장
if ($row[wr_id] == $row[wr_parent] && $key[$i] == "wr_id")
$value[$i] = $save_wr_id;
else if ($key[$i] == "wr_id")
{
$num++;
$value[$i] = $save_wr_id + $num;
}
if (!$query)
$query .= " $key[$i] = '$value[$i]' ";
else
$query .= " ,$key[$i] = '$value[$i]' ";
}
$send_query = " insert into $g5[board_new_table] set " . $query;
mysql_query($send_query);
}
return;
}
?>
게시판 목록
그누보드5 팁자료실
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 공지 | 3년 전 | 4414 | ||
| 54 | 12년 전 | 7043 | ||
| 53 |
senseme
|
12년 전 | 9510 | |
| 52 | 12년 전 | 8960 | ||
| 51 |
takumi22
|
12년 전 | 8603 | |
| 50 |
마스보드포럼
|
12년 전 | 6834 | |
| 49 | 12년 전 | 5882 | ||
| 48 | 12년 전 | 7554 | ||
| 47 | 12년 전 | 7651 | ||
| 46 |
젬스브라운
|
12년 전 | 4817 | |
| 45 | 12년 전 | 6870 | ||
| 44 | 12년 전 | 8413 | ||
| 43 | 12년 전 | 6246 | ||
| 42 |
While
|
12년 전 | 9597 | |
| 41 | 12년 전 | 5355 | ||
| 40 |
푸른하늘3
|
12년 전 | 9664 | |
| 39 |
|
12년 전 | 6635 | |
| 38 | 12년 전 | 8989 | ||
| 37 |
|
12년 전 | 7581 | |
| 36 | 12년 전 | 5210 | ||
| 35 |
21세기소년
|
12년 전 | 6119 | |
| 34 |
rumi717
|
12년 전 | 6807 | |
| 33 |
|
12년 전 | 9734 | |
| 32 | 12년 전 | 9140 | ||
| 31 |
|
12년 전 | 8852 | |
| 30 | 12년 전 | 4846 | ||
| 29 |
|
12년 전 | 7368 | |
| 28 | 12년 전 | 7171 | ||
| 27 | 12년 전 | 6894 | ||
| 26 | 12년 전 | 6659 | ||
| 25 |
|
12년 전 | 5927 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기