Location: PHPKode > projects > Blog Ink Blog System > sitemap.php
<?php
chdir("admin");
require('db.php');
$DB = new DataBase();

$xml = '<?xml version="1.0" encoding="UTF-8"?>
<urlset 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" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
';

$address = $DB->get_setting("siteaddress");
$entries = $DB->get_entries();
$bt = $DB->get_setting("browsingtype");

$xml .= '
	<url>
		<loc>';
if ($bt == "static")
	{ $xml .= $address."pages/index0.html"; }
	
else
	{ $xml .= $address."pages/show.php"; }
$xml .= '</loc>
		<changefreq>daily</changefreq>
		<priority>0.9</priority>
	</url>
	';

foreach($entries as $entry)
{
	$code = '
	<url>
		<loc>';
	
	if ($bt == "static")	
		{ $code .= $address."pages/entry-".$entry["id"].".html"; }
		
	else
		{ $code .= $address."pages/show.php?show=entry&id=".$entry["id"]; }
	$code .= '</loc>
	</url>
	';
	$xml .= $code;
}

$categories = $DB->get_categories();

foreach($categories as $cat)
{
	$code = '
	<url>
		<loc>';
		
	if ($bt == "static")
		{ $code .= $address."pages/category-".$cat["id"].".html"; }
		
	else
		{ $code .= $address."pages/show.php?show=category&id=".$cat["id"]; }
		
	$code .= '</loc>
		<priority>0.8</priority>
	</url>
	';
	$xml .= $code;
}

$xml .= '
</urlset>';

echo $xml;

?>
Return current item: Blog Ink Blog System