Česky
Kamil Dudka

Web components

File detail

Name:Downloadsitemap.xml.gz.xml [Download]
Location: src > page
Size:886 B
Last modification:2007-12-11 16:03

Source code

<?xml version="1.0" encoding="utf-8"?>
<page id='sitemap.xml.gz' visible='no'>
  <name />
  <pageInit>
<?php
// Update SiteMap.php in cache directory if needed
ClassFactory::importClass('PageTransform');
$smCache = $docRoot.$config->cacheDir().'/SiteMap.php';
PageTransform::buildIfNeeded($smCache, 'SiteMapBuilder.xsl');
 
// Process SiteMap.php and catch output
ob_start();
echo '<'.'?xml version="1.0" encoding="UTF-8"?'.">\n"; // Do not concatenate string on this line
require($smCache);
$smContent = ob_get_contents();
ob_end_clean();
 
// Compress output using ZLIB
$tmpDir = $config->documentRoot().$config->tmpDir();
$tmpFile = tempnam($tmpDir, 'SM_XML_GZIP_');
$gz = gzopen($tmpFile, 'wb');
gzwrite($gz, $smContent);
gzclose($gz);
 
// Send to client
header('Content-type: application/x-gzip');
readfile($tmpFile);
unlink($tmpFile);
exit();
?>
  </pageInit>
  <MainPage />
</page>