Código PHP:
<?php
//header('Content-type: text/xml; charset=UTF-8');
include("con.inc");
$link = Connect();
if (!isset($_GET["num"])) {
echo "ERROR, dame un numero!";
exit;
}
$prints = 50;
$sum = 0;
$sitemapnum = $_GET["num"];
$min = $sitemapnum * $prints;
$sacar = mysql_query("SELECT id,titulo,artist FROM files LIMIT $min,$prints");
$XML="<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
$XML.="<urlset xmlns=\"http://www.google.com/schemas/sitemap/0.84\">\n";
while ($ver = mysql_fetch_assoc($sacar)) {
$sum++;
$numrand = rand(2000,4000);
$fecha = date("Y-m-d");
$id= $ver["id"];
$titulo = utf8_decode($ver["titulo"]);
$artist = utf8_decode($ver["artist"]);
$texto_indexa = $titulo."-".$artist;
$texto_indexa = preg_replace('/\s+/', ' ', $texto_indexa);
$texto_indexa = str_replace("#", "", $texto_indexa);
$texto_indexa = str_replace(" ", "-", $texto_indexa);
$texto_indexa = str_replace("%", "", $texto_indexa);
$texto_indexa = str_replace("/", "-", $texto_indexa);
$texto_indexa = str_replace('"\"', "-", $texto_indexa);
$texto_indexa = str_replace("`", "", $texto_indexa);
$texto_indexa = str_replace("'", "", $texto_indexa);
$texto_indexa = str_replace("ñ", "n", $texto_indexa);
$texto_indexa = str_replace("'", "-", $texto_indexa);
$texto_indexa = str_replace("´", "-", $texto_indexa);
$link_indexa = $id.'/'.$texto_indexa;
$url = 'http://www.dominio.com/go/'.$link_indexa;
$XML.= "<url>";
$XML.= "<loc>".$url."</loc>";
$XML.= "<lastmod>{$fecha}T14:18+00:00</lastmod>\n";
$XML.= "<changefreq>weekly</changefreq>\n";
$XML.= "<priority>0.{$numrand}</priority>\n";
$XML.="</url>";
}
$XML.="</urlset>";
echo $XML; // devuelve el xml
?>
Error de lectura XML: entidad no definida
Ubicación: http://domain.com/sitemaps/genera.php?num=2
Número de línea 122, columna 96:</url><url><loc>http://www.domain.com/go/134242/el-sueño-de-morfeo</loc><lastmod>2010-02-12T14:18+00:00</lastmod>
-----------------------------------------------------------------------------------------------^
Ya que me convierte las ñ en ñ es decir, no me hace caso con el utf8_encode
![lloron](http://static.forosdelweb.com/fdwtheme/images/smilies/chillando.png)
![lloron](http://static.forosdelweb.com/fdwtheme/images/smilies/chillando.png)
![lloron](http://static.forosdelweb.com/fdwtheme/images/smilies/chillando.png)
![lloron](http://static.forosdelweb.com/fdwtheme/images/smilies/chillando.png)