Merhabalar,

Her eklenilen yazı için otomatik güncellenen sitemap yapmak istiyorum fakat internette bulduğum yöntemler işe yaramadı.

Şöyle bir kod buldum fakat çalıştıramadım. Neresi yanlış acaba bu kodun?

Alıntı
<?
include 'database.php'; // Database'ye Bağlanmak İçin Olan Php Dosyası
echo '<?xml version="1.0" encoding="UTF-8"?>
<urlset
xmlns="http://www.google.com/schemas/sitemap/0.84"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.google.com/schemas/sitemap/0.84
http://www.google.com/schemas/sitemap/0.84/sitemap.xsd">';
$cek=mysql_query("SELECT * FROM yazilar order by id ASC LIMIT 50000"); // Bu Kısmı Kendi MySql'inize Göre Düzenleyiniz.
while($veri=mysql_fetch_array($cek))
{
?>
<url>
<loc><?=$siteurl?>/<?=$veri['id']; ?>-<?=$veri['seo']; //Bu kısımlarıda Kendi Sisteminize Göre Düzenleyiniz.?></loc>
</url>
<?
echo "\n";
}
?>
</urlset>


--R10.NET; Flood Engellendi -->-> Yeni yazılan mesaj 17:12:09 -->-> Daha önceki mesaj 17:03:22 --

Şu kodlarla işi çözdüm

Alıntı
<?php

include('databse.php'); // Veritabanı bağlantısı yapıyoruz

header('Content-type: text/xml'); // Xml dosyası olduğunu belirtiyoruz.
// Xml tanımları
echo "<?xml version=\"1.0\" encoding=\"ISO-8859-9\" ?>\n";
echo "<urlset xmlns=\"http://www.google.com/schemas/sitemap/0.84\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://www.google.com/schemas/sitemap/0.84 http://www.google.com/schemas/sitemap/0.84/sitemap.xsd\">";

$cek = mysql_query("SELECT * FROM yazilar ORDER BY id DESC"); // Ürünleri Çekiyoruz

while($row = mysql_fetch_array($cek))
{
$date = date("F d, 20y");
$urunsefadi = $row['yazi'];
$urunid = $row['id'];

$xml_ciktisi .= "<url>
<loc>$siteurl/urun/$urunsefadi-$urunid.html</loc>
<lastmod>$date</lastmod>
<changefreq>daily</changefreq>
<priority>0.5</priority>
</url>\n";

};

$xml_ciktisi .= "</urlset>\n";

echo $xml_ciktisi; // Oluşturduğumuz xml çıktısını bastırıyoruz.

?>