스크랩 기능을 이용 댓글쓰기로 변형하였습니다.
본문
뷰페이지에 스크랩 버튼있는거 아시죠?
그걸 리스트에서도 작동하게 했어요..:하루 삽질, 덤프트럭 3대
그런데 또 이걸 변경해서 리스트에서 댓글 쓰기도 가능하게 삽질했어요,,:3일 삽질: 덤프트럭 10대 분량..
삽질은 많이 했지만 잘 작동해요,,ㅎ
bbs/scarap관련 파일을 다른이름 comment로 복사해서 꾸겨넣어요
그런데 용도상 댓글을 쓰면 알림이 작동하게 되어 있는데...
그 코드가 test스킨의 write_update_comment.skin.php에 들어 있는데.
이걸 어떻게 bbs/scarp_popin_update.php가 작동할때 함께 작동(write_update_comment.skin.php)하게 할 수 있을까요?
코드는 이렇습니다.
<?php
include_once('./_common.php');
include_once(G5_PATH.'/head.sub.php');
// 게시글 존재하는지
$wr_content = trim($_POST['wr_content']);
// 덧글이 넘어오고 코멘트를 쓸 권한이 있다면
if ($wr_content && ($member['mb_level'] >= $board['bo_comment_level']))
{
$wr = get_write($write_table, $wr_id);
// 원글이 존재한다면
if ($wr['wr_id'])
{
$mb_id = $member['mb_id'];
$wr_name = addslashes(clean_xss_tags($board['bo_use_name'] ? $member['mb_name'] : $member['mb_nick']));
$wr_password = $member['mb_password'];
$wr_email = addslashes($member['mb_email']);
$wr_homepage = addslashes(clean_xss_tags($member['mb_homepage']));
$sql = " select max(wr_comment) as max_comment from $write_table
where wr_parent = '$wr_id' and wr_is_comment = '1' ";
$row = sql_fetch($sql);
$row['max_comment'] += 1;
$sql = " insert into $write_table
set ca_name = '{$wr['ca_name']}',
wr_option = '',
wr_num = '{$wr['wr_num']}',
wr_reply = '',
wr_parent = '$wr_id',
wr_is_comment = '1',
wr_comment = '{$row['max_comment']}',
wr_content = '$wr_content',
mb_id = '$mb_id',
wr_password = '$wr_password',
wr_name = '$wr_name',
wr_email = '$wr_email',
wr_homepage = '$wr_homepage',
wr_datetime = '".G5_TIME_YMDHIS."',
wr_ip = '{$_SERVER['REMOTE_ADDR']}' ";
sql_query($sql);
$comment_id = sql_insert_id();
// 원글에 코멘트수 증가
sql_query(" update $write_table set wr_comment = wr_comment + 1 where wr_id = '$wr_id' ");
// 새글 INSERT
sql_query(" insert into {$g5['board_new_table']} ( bo_table, wr_id, wr_parent, bn_datetime, mb_id ) values ( '$bo_table', '$comment_id', '$wr_id', '".G5_TIME_YMDHIS."', '{$member['mb_id']}' ) ");
// 코멘트 1 증가
sql_query(" update {$g5['board_table']} set bo_count_comment = bo_count_comment + 1 where bo_table = '$bo_table' ");
// 포인트 부여
insert_point($member['mb_id'], $board['bo_comment_point'], "{$board['bo_subject']} {$wr_id}-{$comment_id} 코멘트쓰기", $bo_table, $comment_id, '코멘트');
}
}
//$sql = " insert into {$g5['scrap_table']} ( mb_id, bo_table, wr_id, ms_datetime ) values ( '{$member['mb_id']}', '$bo_table', '$wr_id', '".G5_TIME_YMDHIS."' ) ";
//sql_query($sql);
include_once(G5_PATH.'/skin/board/test/write_comment_update.skin.php');
delete_cache_latest($bo_table);
echo <<<HEREDOC
<script>
window.close();
</script>
<noscript>
<p>이 글을 스크랩 하였습니다.</p>
<a href="./comment.php">스크랩 확인하기</a>
</noscript>
HEREDOC;
?>
include_once(G5_PATH.'/skin/board/test/write_comment_update.skin.php'); 이거만 인크루드 시켜서 해볼려니 안되네요,,ㅎ
write_update.php 등이 작동하면서 write_comment_update.skin.php 이게 작동해야하니 당연 안될거 같지만,,ㅋ
답변 1
고생하셨네요
몇가지 살펴보시죠
일단,
" bbs/scarp_popin_update.php가 작동할때 함께 작동(write_update_comment.skin.php)하게 할 수 있을까요?"
위의 질문에 따라서, scrap_popin_update.php 파일이 구동되게 되어있다는것을 알수있습니다.
그러면 제가 역으로 질문합니다.
1. scarp_popin_update.php 파일은 지금 해당 게시판에서만 작동하나요?
아니라면
2. 스킨이 테마인지 기본인지 또 다른이름인지 알아야겠죠
3. 모든게시판에서 스크랩이 작동되는지를 판단해서 해당기능이 동일하게 작동할지 말지를 정하셔야합니다.
include_once(G5_PATH.'/skin/board/test/write_comment_update.skin.php')
를 적으신걸로 보아 테이블의 스킨은 test 임을 알수있습니다.
테마를 사용하지도 않았구요
여기에서
write_comment_update.skin.php 파일이 인클루드 되었는지를 먼저 확인해보세요
echo " include write_comment_update.skin.php 전 <br/>";
include_once(G5_PATH.'/skin/board/test/write_comment_update.skin.php')
echo " include write_comment_update.skin.php 후 <br/>";
exit;
로 일단 확인은 해보셔야죠
확인이 끝나고선 다시 주석또는제거 하시구요
마찬가지로 인클루드가 되었는지는
write_comment_update.skin.php'
에서 echo로 상,중,하 영역에 확인가능하실겁니다.
위 언급한 내용들을 살펴보시면 무엇이 비정상이고 무엇이 정상인지 대부분 화인 가능할것으로 생각됩니다.