트랙백의 기능에 대한 이해와 추가기능 정보
트랙백의 기능에 대한 이해와 추가기능본문
트랙백에 대한 기능을 잘 모르시는 초보분들을 위해서 글을 남기며 추가 기능을
넣고자 합니다.
게시글에 있는 트랙백 주소를 복사한 후
내가 새글을 입력할 때 복사한 트랙백 주소를 입력한 후 글을 입력하면
트랙백 주소를 복사했던 글에 코멘트가 기록 되고 나의 글이 링크 됩니다.
주소를 복사한 게시글에 나의 글을 홍보하는 것 경우가 되는 것 같더군요
그래서 내가 쓴 글에도 트랙백 주소를 복사한 글을 소개가 같이 될 수 있도록
수정해 보았습니다.
write_update.skin.php파일에 아래의 내용을 삽입하면 됩니다.
if ($re_trackback) {
$board = sql_fetch(" select bo_subject, bo_use_trackback from $g4[board_table] where bo_table = '$bo_table' ");
if (!$board[bo_use_trackback])
$msg = "트랙백 사용이 금지된 게시판입니다.";
if (!$msg) {
$next_num = get_next_num($write_table);
$sql = " select max(wr_comment) as max_comment from $g4[write_prefix]$bo_table
where wr_parent = '$wr_id' and wr_is_comment = 1 ";
$row = sql_fetch($sql);
$row[max_comment] += 1;
$arr2 = explode("/", $wr_trackback);
$bo2 = $arr2[5];
$wr2 = $arr2[6];
$sql4 = " select * from $g4[write_prefix]{$bo2}
where wr_parent = '$wr2' and wr_is_comment = 0 ";
$row4 = sql_fetch($sql4);
$sql = " insert into $g4[write_prefix]$bo_table
set wr_num = '$next_num',
wr_parent = '$wr_id',
wr_is_comment = '1',
wr_comment = '$row[max_comment]',
wr_content = '$row4[wr_subject]\n$row4[wr_content]',
wr_trackback = '$wr_trackback',
wr_name = '$row4[wr_name]',
wr_password = '".sql_password($g4[server_time])."',
wr_datetime = '$g4[time_ymdhis]',
wr_ip = '$_SERVER[REMOTE_ADDR]' ";
$result = sql_query($sql, FALSE);
if ($result) {
$comment_id = mysql_insert_id();
sql_query(" update $g4[write_prefix]$bo_table set wr_comment = wr_comment + 1 where wr_id = '$wr_id' ", FALSE);
sql_query(" insert into $g4[board_new_table] ( bo_table, wr_id, wr_parent, bn_datetime ) values ( '$bo_table', '$comment_id', '$wr_id', '$g4[time_ymdhis]' ) ");
sql_query(" update $g4[board_table] set bo_count_comment = bo_count_comment + 1 where bo_table = '$bo_table' ", FALSE);
} else
$msg = "$g4[write_prefix]$bo_table TABLE INSERT 오류";
}
}
트랙백 기능이 참 좋은 기능이더군요...^^
도움이 되시길 바랍니다..^^
넣고자 합니다.
게시글에 있는 트랙백 주소를 복사한 후
내가 새글을 입력할 때 복사한 트랙백 주소를 입력한 후 글을 입력하면
트랙백 주소를 복사했던 글에 코멘트가 기록 되고 나의 글이 링크 됩니다.
주소를 복사한 게시글에 나의 글을 홍보하는 것 경우가 되는 것 같더군요
그래서 내가 쓴 글에도 트랙백 주소를 복사한 글을 소개가 같이 될 수 있도록
수정해 보았습니다.
write_update.skin.php파일에 아래의 내용을 삽입하면 됩니다.
if ($re_trackback) {
$board = sql_fetch(" select bo_subject, bo_use_trackback from $g4[board_table] where bo_table = '$bo_table' ");
if (!$board[bo_use_trackback])
$msg = "트랙백 사용이 금지된 게시판입니다.";
if (!$msg) {
$next_num = get_next_num($write_table);
$sql = " select max(wr_comment) as max_comment from $g4[write_prefix]$bo_table
where wr_parent = '$wr_id' and wr_is_comment = 1 ";
$row = sql_fetch($sql);
$row[max_comment] += 1;
$arr2 = explode("/", $wr_trackback);
$bo2 = $arr2[5];
$wr2 = $arr2[6];
$sql4 = " select * from $g4[write_prefix]{$bo2}
where wr_parent = '$wr2' and wr_is_comment = 0 ";
$row4 = sql_fetch($sql4);
$sql = " insert into $g4[write_prefix]$bo_table
set wr_num = '$next_num',
wr_parent = '$wr_id',
wr_is_comment = '1',
wr_comment = '$row[max_comment]',
wr_content = '$row4[wr_subject]\n$row4[wr_content]',
wr_trackback = '$wr_trackback',
wr_name = '$row4[wr_name]',
wr_password = '".sql_password($g4[server_time])."',
wr_datetime = '$g4[time_ymdhis]',
wr_ip = '$_SERVER[REMOTE_ADDR]' ";
$result = sql_query($sql, FALSE);
if ($result) {
$comment_id = mysql_insert_id();
sql_query(" update $g4[write_prefix]$bo_table set wr_comment = wr_comment + 1 where wr_id = '$wr_id' ", FALSE);
sql_query(" insert into $g4[board_new_table] ( bo_table, wr_id, wr_parent, bn_datetime ) values ( '$bo_table', '$comment_id', '$wr_id', '$g4[time_ymdhis]' ) ");
sql_query(" update $g4[board_table] set bo_count_comment = bo_count_comment + 1 where bo_table = '$bo_table' ", FALSE);
} else
$msg = "$g4[write_prefix]$bo_table TABLE INSERT 오류";
}
}
트랙백 기능이 참 좋은 기능이더군요...^^
도움이 되시길 바랍니다..^^
추천
0
0
댓글 4개
흠.. 아무런 변화가 없네요.. 그누초짜라 어떻게 해결을 해야할지;;
이것 덕분에 트랙백 관련 제 문제를 해결하는데 큰 도움이 됬습니다. 참고할 글로 여기에 트랙백을 걸 수 없어 링크를 붙입니다. http://www.biz-nara.com/bbs/tb.php/nanum/153/cd903b7208daec3f07a649412e8a2cab
그런데 여전히 의문이 있는데요. 위 arr2 = explode("/", $wr_trackback);에서 $wr_trackback을 $trackback_url 로 고쳐야 하는 게 아닌가요. 변수 이름이 헤갈리게 하지만 전자는 상대방 글 tb_url, 후자는 내글 url이 아닌가요. lib/trackback_lib.php에서 send_trackback()에서 인자 순서가 그렇게 되어 있던데요. 내 url 일부를 떼어야 $write 테이불을 제대로 찾을 수 있어서요. 그리고 위 $sql=insert....는 결국 내글 일부를 본문 아래에 붙이는게 되네요. 내가 필요한 건 상대 글의 링크와 글 일부 인데.
곰곰히 생각하니 위에서$trackback_url 대신 $wr_trackback이 맞을 수도 있겠네요. 단 이 경우엔 네이버처럼 같은 서버내에서만 되겠네요. 그렇지만 서버가 다르다면 (네이버에서 다음으로) 상대의 링크 주소(url)만 보여 줄수 밖에 없지 않을까요? 트랙백 핑을 보내면 상대 서버는 <reponse>...</response>이외에는 이쪽으로 주는게 없으니 상대글을 (일부라도) 이쪾에 붙이는게 가능할른지.