• 05-07-2013, 17:07:20
    #1
    <? 
    include("ayarzamani.php"); 
    header("Content-Type: text/xml"); 
    if(! isset($_GET[sayfa])) $sayfa=1; else $sayfa=$_GET[sayfa]; 
    $date=date("Y-m-d");  
    if($sayfa=="index"):  
    $index_sayi=mysql_num_rows(mysql_query("SELECT id FROM video"));  
    $index_sayi=ceil($index_sayi / 6000);  
    echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>  <sitemapindex xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\">\n";    
    for($i=0; $i<$index_sayi; $i++){   
    echo "<sitemap>  <loc>http://".$asiteadresi."/sitemap.php?sayfa=".($i+1)."</loc>  <lastmod>$date</lastmod>  </sitemap>\n";   
    }  
    echo "</sitemapindex>";   
    else:   
    $sorgu=mysql_query("SELECT id,title,vid FROM video ORDER BY id ASC LIMIT ".(($sayfa-1)*6000).",5000");    
    echo "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>  <urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\" xmlns:video=\"http://www.google.com/schemas/sitemap-video/1.0\">\n"; 
    while($sonuc=mysql_fetch_assoc($sorgu)):    
    echo " 
    <url> 
        <loc>http://".$site."/".linkvideo($sonuc[vid],$sonuc[title])."</loc> 
        <video:video> 
        <video:thumbnail_loc>http://i.ytimg.com/vi/".$sonuc[vid]."/default.jpg</video:thumbnail_loc> 
        <video:title>".$sonuc[title]."</video:title> 
        </video:video> 
    
    </url>\n 
    "; 
    endwhile; 
    echo '</urlset>';    
    endif;  
    
    ?>
    hata :

    This page contains the following errors:
    
    error on line 2 at column 1: Extra content at the end of the document
    Below is a rendering of the page up to the first error.
    burda sorun nerede arkadaşlar. youtube api script için sitemap yapmaya çalışıyorum..
  • 05-07-2013, 19:08:18
    #2
    Kimlik doğrulama veya yönetimden onay bekliyor.
    <?php
    	
    	/* 
    	 * SAINTX > sitemap.xml creator
    	 * 
    	 * @author: SAINTX
    	 * @web: http://saintx.net
    	 * @mail: im@saintx.net
    	 * @date: 05.07.2013
    	 */
    	# Dosya karakter setini "UTF-8" tipini "text/xml" olarak belirledik.
    	header('Content-Type: text/xml; charset=utf-8');
    	# XML namespace tagını yazdıralım.
    	echo '<?'.'xml version="1.0" encoding="UTF-8"'.'?>';
    	# XML sitemap tagını açalım.
    	echo '<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">';
    	/*
    	 * Uzun uzadıya veritabanı vs. işlemler yapmayıp
    	 * kısacasa for döngüsüyle bi' örnek göstereyim.
    	 */
    	for($i = 1; $i <= 10; ++$i) {
    		echo '<sitemap>';
    			echo '<loc>http://saintx.net/sitemap-'.$i.'.xml</loc>';
    			echo '<lastmod>'.date('Y/m/d').'</lastmod>';
    		echo '</sitemap>';
    	}
    	# XML sitemap tagını kapatalım.
    	echo '</sitemapindex>';
    	
    ?>