<?php
header('Content-Type: text/xml; charset=UTF-8');
echo '<?xml version="1.0" encoding="UTF-8" ?>';
include("includes/config.php");
?>
<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">
	<url>
	<loc>http://www.numanstichting.nl</loc>
	<changefreq>monthly</changefreq>
	<priority>1.00</priority>
</url>
<?php
$result = mysql_query("SELECT * FROM menu INNER JOIN teksten on id = menu_tekst_id WHERE niet_in_menu != 1 AND id != 1 AND menu_parent_id = 0 ORDER BY menu_sort ASC");
while($row = mysql_fetch_assoc($result)){
echo '<url>
  <loc>http://www.numanstichting.nl/'.$row['seo_titel'].'</loc>
  <changefreq>monthly</changefreq>
  <priority>1.00</priority>
</url>
';

$subitems = mysql_query("SELECT * FROM menu INNER JOIN teksten on id = menu_tekst_id WHERE menu_parent_id = $row[menu_id] ORDER BY menu_sort ASC");
while($sub = mysql_fetch_assoc($subitems)){
echo '<url>
  <loc>http://www.numanstichting.nl/'.$row['seo_titel'].'/'.$sub['seo_titel'].'</loc>
  <changefreq>monthly</changefreq>
  <priority>1.00</priority>
</url>
';

if($sub['id'] == 21){
echo 'ja';
	$result2 = mysql_query("SELECT * FROM actualiteiten LEFT JOIN item_types ON ac_type WHERE it_id = 3");
	while($row2 = mysql_fetch_assoc($result2)){
		echo '<url>
		  <loc>http://www.numanstichting.nl/'.$row['seo_titel'].'/'.$sub['seo_titel'].'/'.$row2['seo_titel'].'</loc>
		  <changefreq>monthly</changefreq>
		  <priority>1.00</priority>
		</url>
		';	
	}
}
if($sub['id'] == 22){
	$result2 = mysql_query("SELECT * FROM actualiteiten LEFT JOIN item_types ON ac_type WHERE it_id = 4");
	while($row2 = mysql_fetch_assoc($result2)){
		echo '<url>
		  <loc>http://www.numanstichting.nl/'.$row['seo_titel'].'/'.$sub['seo_titel'].'/'.$row2['seo_titel'].'</loc>
		  <changefreq>monthly</changefreq>
		  <priority>1.00</priority>
		</url>
		';	
	}
}
if($sub['id'] == 23){
	$result2 = mysql_query("SELECT * FROM actualiteiten LEFT JOIN item_types ON ac_type WHERE it_id = 1");
	while($row2 = mysql_fetch_assoc($result2)){
		echo '<url>
		  <loc>http://www.numanstichting.nl/'.$row['seo_titel'].'/'.$sub['seo_titel'].'/'.$row2['seo_titel'].'</loc>
		  <changefreq>monthly</changefreq>
		  <priority>1.00</priority>
		</url>
		';	
	}
}
if($sub['id'] == 25){
	$result2 = mysql_query("SELECT * FROM actualiteiten LEFT JOIN item_types ON ac_type WHERE it_id = 2");
	while($row2 = mysql_fetch_assoc($result2)){
		echo '<url>
		  <loc>http://www.numanstichting.nl/'.$row['seo_titel'].'/'.$sub['seo_titel'].'/'.$row2['seo_titel'].'</loc>
		  <changefreq>monthly</changefreq>
		  <priority>1.00</priority>
		</url>
		';	
	}
}
}
}
?>
</urlset>