<?php
require __DIR__ . '/../includes/configure.php';

header('Content-Type: text/xml; charset=UTF-8');

$base = rtrim(HTTP_SERVER, '/');
$lastmod = date('Y-m-d');
$maps = [
    'sitemapcategory.php',
    'sitemapsubcategory.php',
    'sitemapezpages.php',
    'sitemapimages.php',
    'sitemapproducttags.php',
];

echo '<?xml version="1.0" encoding="UTF-8"?>' . "\n";
?>
<sitemapindex xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/siteindex.xsd"
        xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<?php foreach ($maps as $map): ?>
 <sitemap>
  <loc><?php echo $base . '/sitemap/' . $map; ?></loc>
  <lastmod><?php echo $lastmod; ?></lastmod>
 </sitemap>
<?php endforeach; ?>
</sitemapindex>
