• 04-08-2008, 23:04:38
    #1
    siteme xml sitemap yapmak istiyorum fakat hata veriyor php ile veriyi çekiyorum ama xmlde çalışmıyor bir türlü xml olayını çözemedim ben bu sitemap.php dosyasını htacsess ile xml gibi göstersem olurmu ya da direk sitemap.php kalsa
    olmadı bu sitemapda ki sorun ne acaba ??aldığım hata
    XML Ayrıştırma Hatası: iyi düzenlenmiş değilLocation: http://site.com/sitemap.xmlLine Number 2, Column 3:
    <?
    --^
    kullandığım kodlar
       <?
    header("Content-type: text/xml\n\n");
    echo '<?xml version="1.0" encoding="UTF-8"?>'."\n";
    echo '<!-- generated-on="'.date("d M Y H:i").'" -->'."\n".'<urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">'."\n";
          include("includes/Ayar.inc.php");
            include("includes/Function.inc.php");
    echo "<urlset>";
    			$sql = mysql_query("Select *,i.id as cid from icerik as i inner join kategori as k on i.katid=k.id where i.onay='1' order by RAND() LIMIT 200");
                while($mak= @mysql_fetch_array($sql)) {
                    echo "\t".'<url>'."\n\t\t";
                        echo '<loc><a href=http://www.site.com/'.$mak['katid']."/".Duzenle($mak['kategoriad'])."/".$mak['cid']."/".Duzenle($mak['baslik']).'.html>http://www.zayifguzel.com/'.$mak['katid']."/".Duzenle($mak['kategoriad'])."/".$mak['cid']."/".Duzenle($mak['baslik']).'.html</a><p></loc>'."\n\t\t";
      <lastmod>".$mak[tarih]."</lastmod>
      <changefreq>always</changefreq>
      <priority>0.9</priority>
    </url>";
    }
    echo "
    </urlset>";
    ?>
  • 05-08-2008, 01:34:07
    #2
    Şu olabilir:

    header("Content-type: text/xml\n\n");
    bununla değiştir

    header("Content-type: text/xml");
  • 05-08-2008, 01:37:36
    #3
    hala aynı hatayı alıyorum
  • 05-08-2008, 02:07:07
    #4
    Üyeliği durduruldu
    <?php header("Content-type: text/xml"); ?>
    <?php '<?xml version="1.0" encoding="UTF-8"' ?>
    <?php '<urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">'?>
    <?php 
    include("includes/Ayar.inc.php");
    include("includes/Function.inc.php");
    ?>
    <?php echo '<urlset>' ?>
    <?php $sql = mysql_query("Select *,i.id as cid from icerik as i inner join kategori as k on i.katid=k.id where i.onay='1' order by RAND() LIMIT 200");
    while($mak= @mysql_fetch_array($sql)) {?>
    <?php echo "\t".'<url>'."\n\t\t"; ?>
    <?php echo '<loc><a href=http://www.site.com/.$mak[katid]."/".Duzenle($mak[kategoriad])."/".$mak[cid]."/".Duzenle($mak[baslik]).html>http://www.zayifguzel.com/.$mak[katid]."/".Duzenle($mak[kategoriad])."/".$mak[cid]."/".Duzenle($mak[baslik]).html</a><p></loc>."\n\t\t";' ?>
    <?php echo  '<lastmod>".$mak[tarih]."</lastmod>
      <changefreq>always</changefreq>
      <priority>0.9</priority>
    </url>"'; ?>
    <?php }?>
    <?php echo '</urlset>' ?>
    Buyur Kardeşim.
    Kolay Gelsin.
  • 05-08-2008, 02:09:58
    #5
    Hala aynı hata değildir, satır 2 deki hatayı giderdim, hatanın satır numaralı değişimiştir sende...

    Yukarıdaki arkadaş biraz fazla php etiketi açıp kapamış, sebebini anlamadım.



    Herhangi bir XML hatası almıyorum, şunu dene:

    <?php
    include('includes/Ayar.inc.php');
    include('includes/Function.inc.php');
    
    header('Content-type: text/xml');
    
    echo '<?xml version="1.0" encoding="UTF-8"?>'."\n";
    echo '<!-- generated-on="'.date("d M Y H:i").'" -->'."\n".'<urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">'."\n";
    echo "<urlset>";
    
    $sql = mysql_query("Select *,i.id as cid from icerik as i inner join kategori as k on i.katid=k.id where i.onay='1' order by RAND() LIMIT 200");
    
    while($mak= @mysql_fetch_array($sql)) 
    {
    	echo "\t".'<url>'."\n\t\t";
    	echo '<loc><a href=http://www.site.com/'.$mak['katid']."/".Duzenle($mak['kategoriad'])."/".$mak['cid']."/".Duzenle($mak['baslik']).'.html>http://www.zayifguzel.com/'.$mak['katid']."/".Duzenle($mak['kategoriad'])."/".$mak['cid']."/".Duzenle($mak['baslik']).'.html</a><p></loc>'."\n\t\t";
    
    	echo'<lastmod>'.$mak[tarih].'</lastmod>
    	<changefreq>always</changefreq>
    	<priority>0.9</priority>
    	</url>';
    }
    
    echo '</urlset>';
    ?>
  • 05-08-2008, 09:42:50
    #6
    saolun beyler ama ikiside olmadı
    doğu_beyin verdiği kodda aldığım hata
    XML Ayrıştırma Hatası: eleman bulunamadıLocation: http://site.com/sitem22ap.xmlLine Number 18, Column 27:<?php echo '</urlset>' ?> 
    --------------------------^
    alexisin verdiği kodda verdiği hata
    XML Ayrıştırma Hatası: iyi düzenlenmiş değilLocation: http://site.com/sitem22ap.xmlLine Number 8, Column 7:
    echo '<!-- generated-on="'.date("d M Y H:i").'" -->'."\n".'<urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">'."\n";
    ------^
    ++bu xml desteklemesi için ek olarak bişey(ayar dosyası gibi) gerekmiyor dimi bu sitemap olayına ilk defa girdim de
  • 05-08-2008, 10:32:42
    #7
    Sağ tıkla ve kaynaktan php hatalarına bak, Ayar.inc.php, Function.inc.php yerinde mi, SQL sorgun çalışıyor mu?
  • 05-08-2008, 10:50:25
    #8
    sorgum sorunsuz çalışıyor php olarak sorun çıkarmıyor ama php olarak verdiğimde google 0 url gördü neyse bu olmayacak ben sitemapz.com dan xml cıkartıp yükeyeyim yardımlarınız için sağolun