사이트맵 생성하는 php 관련 질문입니다.

사이트맵 생성하는 php 관련 질문입니다.

QA

사이트맵 생성하는 php 관련 질문입니다.

본문

<?php

include_once("./_common.php");

 

$charset = $g5[charset];

$url = "https://www.example.com"; //::::::::::::::: write your GNUboard root path

 

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";

?>

<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">

<?php

$query = sql_query("select bo_table from `g5_write_test_board` where as_list='1'");

while($temp = sql_fetch_array($query)) {

        $bo_arr = $temp;

}

$i = 1;

foreach($bo_arr as $bo) {

        // list of bo_table

        echo "<url>\n";

        echo "<loc>$url/bbs/board.php?bo_table=$bo</loc>\n";

        $temp = sql_fetch("select wr_datetime from `$g5[write_prefix]$bo` order by wr_datetime DESC");

        $lastmod = str_replace(" ", "T", substr($temp[wr_datetime], 0, 30))."+00:00";

 

        // if

        if(!$lastmod || strlen($lastmod) < 25 || strcmp($lastmod, "+00:00")) $lastmod = "2014-10-10T00:00:00+00:00";

 

        echo "<lastmod>$lastmod</lastmod>\n";

        echo "<changefreq>daily</changefreq>\n";

        echo "<priority>0.9</priority>\n";

        echo "</url>\n";

 

        $query = sql_query("select wr_id, wr_datetime from `$g5[write_prefix]$bo` where wr_is_comment='0' AND wr_option NOT LIKE '%secret%'");

        while($row = sql_fetch_array($query)) {

                // list of each article

                echo "<url>";

                echo "<loc>$url/bbs/board.php?bo_table=$bo&wr_id=$row[wr_id]</loc>";

                $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 "<lastmod>$lastmod</lastmod>";

                echo "<changefreq>weekly</changefreq>";

                echo "<priority>0.5</priority>";

                echo "</url>\n";

        }

        $i++;

}

?>

</urlset>

 

원래 코딩되어있던걸 이런식으로 수정해서 g5_write_test_ board만 사이트 맵을 생성하려고 하는데요...

결과가 이렇습니다.

 

This XML file does not appear to have any style information associated with it. The document tree is shown below.

<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"></urlset>

 

 

도저히 어디가 잘못됐는지 모르겠습니다.

$query = sql_query("select bo_table from `g5_write_test_board` where as_list='1'");

while($temp = sql_fetch_array($query)) {

        $bo_arr = $temp;

}

 

여기서 특정 게시판으로 선별됐다고 생각하는데.... 

아직 초보자라서 그런지 잘 모르겠네요 ㅠㅠ

 

이 질문에 댓글 쓰기 :

답변 1


$query = sql_query("select bo_table from `g5_write_test_board` where as_list='1'");
while($temp = sql_fetch_array($query)) {
        $bo_arr = $temp;
}


$query = sql_query("select bo_table from `g5_board` where 1");
while($temp = sql_fetch_array($query)) {
        $bo_arr[] = $temp['bo_table'];
}

로 변경해보세요.

 

test_board 게시판만 선정하고 싶으시면

변경된


$query = sql_query("select bo_table from `g5_board` where 1");
while($temp = sql_fetch_array($query)) {
        $bo_arr[] = $temp['bo_table'];
}

부분을 지우시고


$bo_arr[] = 'test_board'

를 넣어보세요.

답변을 작성하시기 전에 로그인 해주세요.
전체 51
QA 내용 검색

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1404호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT