http://demo.merkezweb.net
> Anasayfa > Makaleler > PHP > Sitenize RSS Sayfası Oluşturma
Web Galeriden
1489 adet Kaliteli Png icon
Attachment
Sitenize RSS Sayfası Oluşturma
Tarih 05/05/2009 01:20  Yazar muyst  Hitler 2928  Dil Varsayılan
bizim sitemizde ve artık hemen hemen yeni yapılan tüm sitelerde gördüğünüz RSS aboneliği desteğini nasıl yapabileceğiniz bu makalede göreceğiz.
Aslında anlatım değil uygulama örneğini vereceğim.

<?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 ile ilgili sitemizde bir iki makale daha var önce onları okuyarak başlamanız sizin için daha iyi olacaktır..
Yorum Yok.