K
Kauperwood
нормально так будет?
PHP:
function sitemapgenerator() {
$urls = "";
$head = '<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.google.com/schemas/sitemap/0.84">'."\n";
$legs = '</urlset>';
$sql = mysql_query('SELECT * FROM content');// выводим поля
while($record = mysql_fetch_array($sql)) {
$urls .= "<url>\n<loc>index.php?pageid=".$record['pageid']."</loc>\n<lastmod>".date("Y-m-d")."</lastmod>\n<changefreq>weekly</changefreq>\n<priority>0.5</priority>\n</url>\n";
}
$smaps = "sitemap.xml";
if(is_file($smaps)){
$fo = fopen($smaps, "w");
$fw=fputs($fo,$head.$urls.$legs);
fclose($fo);
}
else {
print "error";
}
}