PHP RSS Sayfası Oluşturma
-
Uygulama Örneği:
<?php
$output = '
<rss version="2.0">
<channel>';
mysql_connect('localhost','user','pass');
mysql_select_db('news');
//set the content type to xml
header("Content-Type: text/xml");
$sql = mysql_query("SELECT * FROM news LIMIT 10");
while($res = mysql_fetch_array($sql))
{
$title = $res['title'];
$description = $res['description'];
$author = $res['author'];
$id = $res['id'];
$link = "http://www.yoursite.com/news.php?id=$id";
$output .= <<<EOT
<item>
<title>The Your Site News</title>
<link>http://www.yoursite.com/</link>
<description>$description</description>
</item>
EOT;
}
$output .= '
</channel>
</rss>';
echo $output;
?>
rss.php olarak kaydediyoruz
adres penceresinde rss buttonunu göstermek için;
<link rel="alternate" type="application/rss+xml" title=" (RSS 2.0)" href="http://siteadresi/rss.php" />
-
sağol dostum işe yarar
-
<item>
<title>The Your Site News</title>
<link>http://www.yoursite.com/</link>
<description>$description</description>
</item>title, linki almışsın ama döngüye sokarken kullanmamışsınki,..
ayrıca her sistem farklıdır, oturup baştan yazmak gerekir.
