<?php require_once("inc/connection.php"); require_once("inc/framework.php"); ?>
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
		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/sitemap.xsd">
<?php

print getSiteMapForSearchBots();


function getSiteMapForSearchBots($parentToget = 0) {
	global $DRAGGIN;

	$toReturn = "";
	$getMyTopPages = "SELECT parentID, itemID, url, target, label, pageID										  
					  FROM sysTBLNav
					  WHERE open = '1' AND (parentID IS NULL OR parentID = '$parentToget') ORDER BY myOrder ASC;";
	
	$Result = mysql_query($getMyTopPages, $DRAGGIN['dbgen']['link']);
		while($navRS = mysql_fetch_array($Result)) {
			$toReturn .= "\t<url>\n";
			if(!empty($navRS['url'])) {
				$toReturn .= "\t\t<loc>" . htmlentities($navRS['url']) . "</loc>\n";
			} else {
				$toReturn .= "\t\t<loc>http://www.portcolborne.ca" . htmlentities($DRAGGIN['settings']['urlpath'] . returnSpecificItem($navRS['pageID'], "sysTBLPage", "systemName")) . "</loc>\n";
			}
			$toReturn .= "\t</url>\n";
			$toReturn .= getSiteMapForSearchBots($navRS['itemID']);
		}
	return $toReturn;
	}
?>
</urlset>

