You are here

function xmlsitemap_output_chunk in XML sitemap 7.2

Same name and namespace in other branches
  1. 6.2 xmlsitemap.pages.inc \xmlsitemap_output_chunk()

Output a sitemap page.

See also

xmlsitemap_sitemap_load_by_context()

xmlsitemap_get_current_chunk()

xmlsitemap_sitemap_get_file()

xmlsitemap_output_file()

1 string reference to 'xmlsitemap_output_chunk'
xmlsitemap_menu in ./xmlsitemap.module
Implements hook_menu().

File

./xmlsitemap.pages.inc, line 36
Page callbacks for the xmlsitemap module.

Code

function xmlsitemap_output_chunk() {
  $sitemap = xmlsitemap_sitemap_load_by_context();
  if (!$sitemap) {
    return MENU_NOT_FOUND;
  }
  $chunk = xmlsitemap_get_current_chunk($sitemap);
  $file = xmlsitemap_sitemap_get_file($sitemap, $chunk);

  // Provide debugging information if enabled.
  if (variable_get('xmlsitemap_developer_mode', 0) && isset($_GET['debug'])) {
    $output = array();
    $context = xmlsitemap_get_current_context();
    $output[] = "Current context: " . print_r($context, TRUE);
    $output[] = "Sitemap: " . print_r($sitemap, TRUE);
    $output[] = "Chunk: {$chunk}";
    $output[] = "Cache file location: {$file}";
    $output[] = "Cache file exists: " . (file_exists($file) ? 'Yes' : 'No');
    return implode('<br />', $output);
  }
  return xmlsitemap_output_file($file);
}