[질답/버그/제안] 구글뉴스 사이트맵 ?
작성자 정보
- 관리자 작성
- 작성일
컨텐츠 정보
- 312 조회
-
목록
본문
안녕 하세요
구글검색 하고 뉴스하고
사이트맵이 다르네요
그래서 그누에서 아래소스를 찻아서
php 파일로 저장한후 호출 하니까
페이지가 작동하지 않습니다
라고 에러가 나네요 ㅠㅠ
어디에 뭐가 잘못된걸까요 ?
고수님들 아래소스 보시고
조언좀 부탁 드립니다
제발 꼭좀 알려 주십시요
다시한번 부탁 드립니다
감사 합니다
<?php
// please give feedbacks to bomool.net
include_once("_common.php");
$charset = $g5[charset];
$url = "http://www.ntnews.kr"; //::::::::::::::: write your GNUboard root path
// 특수문자 변환. 변환하지않으면 XML 문법에 맞지 않으니까 변환해야합니다.
function specialchars_replace($str, $len=0) {
if ($len) { // 두번째 인자로 길이 값을 주면 그 길이만큼만 잘르고 나머지는 버린 후 치환합니다
$str = substr($str, 0, $len);
}
// 정규식으로 치환해야 제대로 원하는 것만 치환시키겠죠..
$str = preg_replace("/&/", "&", $str);
$str = preg_replace("/", "<", $str);
$str = preg_replace("/>/", ">", $str);
return $str;
}
header("Content-type: text/xml;charset="UTF-8"");
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
echo "<?xml version="1.0" encoding="UTF-8"?>n";
?>
xmlns:news="http://www.google.com/schemas/sitemap-news/0.9">
<?php
$query = sql_query("select bo_table from `$g5[board_table]` where bo_read_level='1'");
while($temp = sql_fetch_array($query)) {
$bo_arr[] = $temp[bo_table];
}
$i = 1;
foreach($bo_arr as $bo) {
$query = sql_query("select wr_id, wr_datetime, wr_subject from `$g5[write_prefix]$bo` where wr_is_comment='0' AND wr_option NOT LIKE '%secret%'");
while($row = sql_fetch_array($query)) {
// list of bo_table
echo "n";
echo "$url/bbs/board.php?bo_table=$bo&wr_id=$row[wr_id]n";
$temp = sql_fetch("select wr_datetime from `$g5[write_prefix]$bo` where wr_parent='$row[wr_id]' order by wr_id DESC");
$lastmod = str_replace(" ", "T", substr($temp[wr_datetime], 0, 30))."+00:00";
if(!$lastmod) {
$temp = sql_fetch("select wr_datetime from `$g5[write_prefix]$bo` where wr_id='$row[wr_id]'");
$lastmod = str_replace(" ", "T", substr($temp[wr_datetime], 0, 30))."+00:00";
}
if(!$lastmod) $lastmod = $g5[time_ymd];
echo "n";
echo "n";
echo "<".specialchars_replace("엔티뉴스채널")."n'>news:name>".specialchars_replace("엔티뉴스채널")."n";
echo "<".specialchars_replace("ko")."n'>news:language>".specialchars_replace("ko")."n";
echo "n";
echo "<".specialchars_replace("$lastmod")."n'>news:publication_date>".specialchars_replace("$lastmod")."n";
echo "".specialchars_replace('['.$board['bo_subject'].'] '.$row['wr_subject'])."n";
echo " n";
echo "n";
}
$i++;
}
?>
관련자료
-
링크