i have following problem, i generated the urls for the sitemap after url 50K this code wont make new sitemap like sitemap2.xml or sitemap3.xml
header('Content-type: application/xml; charset="ISO-8859-1"', true);
$dataAll1 = scandir('cache-data');
unset($dataAll1[0]);
unset($dataAll1[1]);
unset($dataAll1[2]);
$sitemap = '<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="'.PROTOCOL.'://www.sitemaps.org/schemas/sitemap/0.9">';
$sitemap .= '<url>
<loc>' . SITE_HOST . '</loc>
<priority>1.0</priority>
</url>';
foreach($dataAll1 as $val){
$data = json_decode(file_get_contents('cache-data/'.$val),1);
if($val=='index.php'){
continue;
}
$sitemap .= '<url>
<loc>'.SITE_HOST . '/blog/' . $data['jk'].'jktk'.$data['tk'] . '-' . $service->slugify($data['title']).'</loc>
<priority>0.9</priority>
<changefreq>daily</changefreq>
</url>';
}
$sitemap.='</urlset>';
echo $sitemap;
how to write the correct code for the code above so that you can create a new sitemap after reaching 50K urls?
all help is very valuable
Aucun commentaire:
Enregistrer un commentaire