Scz ca am intarziat cu raspunsul.
Poftim am facu exact ce mi-ai dat:
erori normal ca apar :
Eroare la analiza XML: nu este bine format
Adresă:
http://www.scapadeplictiseala.tk/site.xmlNumăr linie 1, coloană 37:
<xml version="1.0" encoding="UTF-8" ?>
------------------------------------------------^
Daca folosesc asa :
<?xml version="1.0" encoding="UTF-8"?>
eroare :
Eroare la analiza XML: gunoi după elementul document
Adresă:
http://www.scapadeplictiseala.tk/site.xmlNumăr linie 9, coloană 10:
</urlset><urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
------------^
Cred ca am spus de cateva ori ca da folosesc asa <?xml version="1.0" encoding="UTF-8"?> si asa <xml version="1.0" encoding="UTF-8"?> da erori!
Cod: Selectaţi tot
<?php header("Content-type: text/xml"); require_once('conectare.php');
echo '<xml version="1.0" encoding="UTF-8" ?>'."\n"; pai mai sus spui ca e corect asa <?xml version="1.0" encoding="UTF-8"?> dar mai jos dai asa <xml version="1.0" encoding="UTF-8"?>
$cerereSQL = "SELECT * FROM `membri` ORDER BY id DESC";
$rezultat = mysql_query($cerereSQL);
while( $rand = mysql_fetch_array($rezultat) ) {
echo '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">';
echo '
<url>
<loc>http://www.scapadeplictiseala.tk/profil-'.$rand['nume'].'.php</loc>
<lastmod>2013-01-26</lastmod>
<changefreq>always</changefreq>
<priority>1.0</priority>
</url>
';
echo '</urlset>';
}
echo '</xml>';
?>
vectorialpx scrie:Nu are legatura cu PHP-ul. Si tag-ul de XML se inchide tot asa... trebuie doar sa fie intre ghilimele.
e foarte corect.
Problema ta este ca ai mai multe XML-uri intr-un singur fisier, ceea ce nu se poate.
Cod: Selectaţi tot
while($rand = mysql_fetch_array($rezultat)) {
echo '<xml version="1.0" encoding="UTF-8" ?>';
e o imbecilitate. Cum sa pui header-ul in while?
Rezultatul este, dupa cum se vede in documentul tau
<xml version="1.0" encoding="UTF-8" ?><urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>http://www.scapadeplictiseala.tk/profil-thunderman.php</loc>
<lastmod>2013-01-26</lastmod>
<changefreq>always</changefreq>
<priority>1.0</priority>
</url>
</urlset></xml><xml version="1.0" encoding="UTF-8" ?><urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>http://www.scapadeplictiseala.tk/profil-gabriel.php</loc>
<lastmod>2013-01-26</lastmod>
<changefreq>always</changefreq>
<priority>1.0</priority>
</url>
</urlset></xml><xml version="1.0" encoding="UTF-8" ?><urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>http://www.scapadeplictiseala.tk/profil-alexandru73.php</loc>
<lastmod>2013-01-26</lastmod>
<changefreq>always</changefreq>
<priority>1.0</priority>
</url>
</urlset></xml><xml version="1.0" encoding="UTF-8" ?><urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>http://www.scapadeplictiseala.tk/profil-firebleast.php</loc>
<lastmod>2013-01-26</lastmod>
<changefreq>always</changefreq>
<priority>1.0</priority>
</url>
</urlset></xml><xml version="1.0" encoding="UTF-8" ?><urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>http://www.scapadeplictiseala.tk/profil-danuta1986.php</loc>
<lastmod>2013-01-26</lastmod>
<changefreq>always</changefreq>
<priority>1.0</priority>
In speranta ca vei rezolva problema si o sa scapam de acest thread, iti ofer un copy-paste:
Cod: Selectaţi tot
echo '<xml version="1.0" encoding="UTF-8" ?>'."\n";
while( $rand = mysql_fetch_array($rezultat) ) {
echo '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">';
echo '
<url>
<loc>http://www.scapadeplictiseala.tk/profil-'.$rand['nume'].'.php</loc>
<lastmod>2013-01-26</lastmod>
<changefreq>always</changefreq>
<priority>1.0</priority>
</url>
';
echo '</urlset>';
}
echo '</xml>';