File: D:/HostingSpaces/SBogers59/ferrumbv.nl/wwwroot/sitemap.xml.php
<?php
// Errors
ini_set('display_errors', 1);
ini_set('log_errors', 1);
ini_set('error_log', dirname(__FILE__) . '/error_log.txt');
error_reporting(E_ALL ^ E_WARNING);
ini_set("display_errors", 1);
define('URL_LANG','nl');
// Includes
include_once $_SERVER['DOCUMENT_ROOT'] . '/kms/config/connect.php';
include_once $_SERVER['DOCUMENT_ROOT'] . '/kms/lib/general/db_handler.class.php';
include_once $_SERVER['DOCUMENT_ROOT'] . '/lib/general/functions.class.php';
/**
* sitemap.xml.php
* Created by Komma Mediadesign.
* Author: mike
* Date: 16/05/14
*/
if(substr($_SERVER['HTTP_HOST'],0,3) != 'www')
{
header ('HTTP/1.1 301 Moved Permanently');
$location = 'http://www.' . $_SERVER['HTTP_HOST'];
if( ! empty($_SERVER['REQUEST_URI'])) $location .= $_SERVER['REQUEST_URI'];
header('location: ' . $location);
exit;
}
// Product output
global $pdo;
$root = 'http://' . $_SERVER['HTTP_HOST'] . '/';
$date = date('Y-m-d');
$Db = new DatabaseHandler($pdo);
$Db->setTableName('products_items');
$Db->setOrder('itemOrder','DESC');
$Db->setActiveOnly(true,1);
$data = $Db->select();
$products = $Db->twoDimensional($data);
// Generate output
$productOutput = '';
foreach($products as $key => $product)
{
$title = Fn::encodeUrl($product['title']);
$productOutput .= ' <url>
<loc>' . $root . 'producten/' . $title . '</loc>
<lastmod>' . $date . '</lastmod>
<changefreq>weekly</changefreq>
<priority>0.5</priority>
</url>';
}
header("Content-type: text/xml");
echo("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc><?php echo $root; ?></loc>
<lastmod><?php echo($date); ?></lastmod>
<changefreq>weekly</changefreq>
<priority>0.5</priority>
</url>
<url>
<loc><?php echo $root; ?>bedrijfsprofiel</loc>
<lastmod><?php echo($date); ?></lastmod>
<changefreq>weekly</changefreq>
<priority>0.5</priority>
</url>
<url>
<loc><?php echo $root; ?>producten</loc>
<lastmod><?php echo($date); ?></lastmod>
<changefreq>weekly</changefreq>
<priority>0.5</priority>
</url>
<url>
<loc><?php echo $root; ?>producten/mechatronica</loc>
<lastmod><?php echo($date); ?></lastmod>
<changefreq>weekly</changefreq>
<priority>0.5</priority>
</url>
<url>
<loc><?php echo $root; ?>producten/3d-frezen-en-meten</loc>
<lastmod><?php echo($date); ?></lastmod>
<changefreq>weekly</changefreq>
<priority>0.5</priority>
</url>
<?= $productOutput ?>
<url>
<loc><?php echo $root; ?>werkwijze</loc>
<lastmod><?php echo($date); ?></lastmod>
<changefreq>weekly</changefreq>
<priority>0.5</priority>
</url>
<url>
<loc><?php echo $root; ?>werkwijze/offerte</loc>
<lastmod><?php echo($date); ?></lastmod>
<changefreq>weekly</changefreq>
<priority>0.5</priority>
</url>
<url>
<loc><?php echo $root; ?>werkwijze/begeleiding</loc>
<lastmod><?php echo($date); ?></lastmod>
<changefreq>weekly</changefreq>
<priority>0.5</priority>
</url>
<url>
<loc><?php echo $root; ?>werkwijze/productie</loc>
<lastmod><?php echo($date); ?></lastmod>
<changefreq>weekly</changefreq>
<priority>0.5</priority>
</url>
<url>
<loc><?php echo $root; ?>werkwijze/transport</loc>
<lastmod><?php echo($date); ?></lastmod>
<changefreq>weekly</changefreq>
<priority>0.5</priority>
</url>
<url>
<loc><?php echo $root; ?>werkwijze/retourzending</loc>
<lastmod><?php echo($date); ?></lastmod>
<changefreq>weekly</changefreq>
<priority>0.5</priority>
</url>
<url>
<loc><?php echo $root; ?>machines</loc>
<lastmod><?php echo($date); ?></lastmod>
<changefreq>weekly</changefreq>
<priority>0.5</priority>
</url>
<url>
<loc><?php echo $root; ?>machines/draaien</loc>
<lastmod><?php echo($date); ?></lastmod>
<changefreq>weekly</changefreq>
<priority>0.5</priority>
</url>
<url>
<loc><?php echo $root; ?>machines/frezen</loc>
<lastmod><?php echo($date); ?></lastmod>
<changefreq>weekly</changefreq>
<priority>0.5</priority>
</url>
<url>
<loc><?php echo $root; ?>machines/machinelijst</loc>
<lastmod><?php echo($date); ?></lastmod>
<changefreq>weekly</changefreq>
<priority>0.5</priority>
</url>
<url>
<loc><?php echo $root; ?>referenties</loc>
<lastmod><?php echo($date); ?></lastmod>
<changefreq>weekly</changefreq>
<priority>0.5</priority>
</url>
<url>
<loc><?php echo $root; ?>contact</loc>
<lastmod><?php echo($date); ?></lastmod>
<changefreq>weekly</changefreq>
<priority>0.5</priority>
</url>
<url>
<loc><?php echo $root; ?>offerte-aanvragen</loc>
<lastmod><?php echo($date); ?></lastmod>
<changefreq>weekly</changefreq>
<priority>0.5</priority>
</url>
</urlset>