묻고답하기
page_full_width" class="col-xs-12" |cond="$__Context->page_full_width">
RSS 만드는 방법 질문...입니다.. ;ㅁ;
2006.11.21 16:56
PHP로 RSS를 만들고 싶은데;
간단한게 아니던군요;
<?php
$connect = mysql_connect('localhost','id','password');
mysql_select_db('name');
$query = "select * from test";
$result = mysql_query($query, $connect);
echo "<?xml version="1.0" encoding="UTF-8"?>n";
?>
<rss version="2.0">
<channel>
<title>LIM's RSS TEST</title>
<link>http://web-memo.org/study/rss.php</link>
<description>TEST RSS</description>
<language>ko</language>
<?php while($data = mysql_fetch_array($result)){ ?>
<item>
<title><![CDATA[<?=$data[subject]?>]]></title>
<link><?=$data[url]?></link>
<description><![CDATA[<?=$data[content]?>]]></description>
<category><?=$data[category]?></category>
<author><?=$data[name]?></author>
<pubDate><?=$data[regdate]?></pubDate>
</item>
<?php } ?>
</channel>
</rss>
<?php mysql_close($connect); ?>
-----------------------------------------------------
대략 이렇게 한번 작성해 보았는데.. (rss.php)
rss.php로 불러드리면은 그냥 글씨밖에 안보이는데..(소스 보기로 보면은 RSS형태로 보임)
이방법이 틀린건가요??
간단한게 아니던군요;
<?php
$connect = mysql_connect('localhost','id','password');
mysql_select_db('name');
$query = "select * from test";
$result = mysql_query($query, $connect);
echo "<?xml version="1.0" encoding="UTF-8"?>n";
?>
<rss version="2.0">
<channel>
<title>LIM's RSS TEST</title>
<link>http://web-memo.org/study/rss.php</link>
<description>TEST RSS</description>
<language>ko</language>
<?php while($data = mysql_fetch_array($result)){ ?>
<item>
<title><![CDATA[<?=$data[subject]?>]]></title>
<link><?=$data[url]?></link>
<description><![CDATA[<?=$data[content]?>]]></description>
<category><?=$data[category]?></category>
<author><?=$data[name]?></author>
<pubDate><?=$data[regdate]?></pubDate>
</item>
<?php } ?>
</channel>
</rss>
<?php mysql_close($connect); ?>
-----------------------------------------------------
대략 이렇게 한번 작성해 보았는데.. (rss.php)
rss.php로 불러드리면은 그냥 글씨밖에 안보이는데..(소스 보기로 보면은 RSS형태로 보임)
이방법이 틀린건가요??