function _xmlsitemap_output_chunk in XML sitemap 5.2
Same name and namespace in other branches
- 5 xmlsitemap.module \_xmlsitemap_output_chunk()
Display a chunk of the sitemap.
Parameters
$chunk: An integer specifying which chunk of the sitemap to display:
Return value
None
1 call to _xmlsitemap_output_chunk()
- xmlsitemap_output in xmlsitemap/
xmlsitemap.module - Menu callback; display the sitemap.
File
- xmlsitemap/
xmlsitemap.module, line 561 - Creates a sitemap compatible with the sitemaps.org schema.
Code
function _xmlsitemap_output_chunk($chunk = 0) {
print '<?xml version="1.0" encoding="UTF-8"?>' . "\n";
print '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"' . "\n";
print ' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"' . "\n";
print ' xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9' . "\n";
print ' http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">' . "\n";
$chunk_size = variable_get('xmlsitemap_chunk_size', 50000);
$start = $chunk * $chunk_size;
$links = db_query_range("SELECT * FROM {xmlsitemap} ORDER BY priority DESC, lastmod DESC, changefreq, loc", $start, $chunk_size);
while ($link = db_fetch_array($links)) {
print ' <url>' . "\n";
print ' <loc>' . check_url($link['loc']) . '</loc>' . "\n";
if (isset($link['lastmod'])) {
print ' <lastmod>' . gmdate('Y-m-d\\TH:i:s+00:00', $link['lastmod']) . '</lastmod>' . "\n";
}
if (isset($link['changefreq'])) {
print ' <changefreq>' . xmlsitemap_sitemap_frequency($link['changefreq']) . '</changefreq>' . "\n";
}
if (isset($link['priority']) && $link['priority'] <= 1 && $link['priority'] >= 0) {
print ' <priority>' . number_format($link['priority'], 1) . '</priority>' . "\n";
}
print ' </url>' . "\n";
}
print '</urlset>';
}