다음의 내용을
inc_function.php 의 적당한 위치에 넣어줍니다. 적당한 위치를 모르시겠다면, 1300 번째 줄 근처에 위치한
function update_xml() 이라고 표시되어있는 줄 위쪽으로 삽입해주시면 되겠습니다.
function reply_xml () {
global $db, $dbid, $p_title, $p_user_nick, $s_root_path;
$rtime = get_rss_stamp(mktime());
list($st, $header, $body, $lmdate, $xmlinfo) = xml_parser($s_root_path."reply.xml","");
$rss .= "<?xml version='1.0' encoding='euc-kr' ?>
";
$rss .= "<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:admin="http://webns.net/mvcb/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
";
$rss .= "<channel>
";
$rss .= "<title>${p_title}의 댓글</title>
";
$rss .= "<link>$s_root_path"."index.php</link>
";
$rss .= "<dc:language>EUC-KR</dc:language>
";
$rss .= "<dc:creator>$p_user_nick</dc:creator>
";
$rss .= "<dc:date>$rtime</dc:date>
";
$sql = "
select
A.no, A.pno, A.name, A.body, A.regdate,
B.title
from
t3_".$dbid."_reply as A left join t3_".$dbid." as B
on A.pno = B.no
where
A.password <> 'secret_rep'
order by
A.no desc
limit 10
";
$result = @mysql_query($sql);
while(list($no, $pno, $name, $body, $regdate, $title) = @mysql_fetch_array($result)) {
$body = htmlspecialchars($body);
$link = htmlspecialchars($s_root_path."index.php?pl=$pno#r$no");
$regdate = get_rss_stamp($regdate);
$rss .= "<item>
";
$rss .= "<link>$link</link>
";
$rss .= "<title>$title</title>
";
$rss .= "<description>$body</description>
";
$rss .= "<dc:creator>$name</dc:creator>
";
$rss .= "<dc:date>$regdate</dc:date>
";
$rss .= "</item>
";
}
$rss .= "</channel>
";
$rss .= "</rss>";
$out = fopen($r_root_path."reply.xml", "w");
@chmod($r_root_path."reply.xml", 0777);
fwrite($out, $rss);
fclose($out);
}
그리고 다음으로
add_exe.php 파일의 40 번째 줄의 다음과 같이 추가해주시면 됩니다.
set_rp_cnt($num);
check_query();
reply_xml();
굵은 색 글씨가 추가된 부분입니다.
패치는 이것으로 끝이고요.
태터툴의 RSS 주소가 다음과 같을 때.
http://golbin.net/tt/index.xml
댓글의 RSS 주소는 다음과 같습니다.
http://golbin.net/tt/reply.xml
대충 감이 오시죠? 이 주소를 RSS 리더에 넣어주시고 주기적으로 확인하는 옵션을 켜 주시면 댓글이 달렸을 때 알려주는 기능이 완성됩니다.
참. 제가 만들었던 비공개 댓글을 패치하신 분은 이미 비공개 댓글 안나오게 되어 있으니 안심하셔도 되고요,
현재 최근 글 10 개까지만 출력되게 되어 있는데, 그걸 늘리거나 줄이실 분은 위의 소스에서
limit 10 부분을 찾아 뒤의 숫자를 5, 20 뭐 이렇게 바꿔주시면 됩니다.