CODE
<?php
require_once('config.php');
require_once('common.php');
$xml = '';
$priority = '0.5';
$freq = 'weekly';
$xml .= "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
$xml .= "<urlset\n";
$xml .= " xmlns=\"http://www.google.com/schemas/sitemap/0.84\"\n";
$xml .= " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n";
$xml .= " xsi:schemaLocation=\"http://www.google.com/schemas/sitemap/0.84\n";
$xml .= " http://www.google.com/schemas/sitemap/0.84/sitemap.xsd\">\n\n";
$xml .= "<url>\n";
$xml .= " <loc>http://$_SERVER[HTTP_HOST]/</loc>\n";
$xml .= " <priority>$priority</priority>\n";
$xml .= " <changefreq>$freq</changefreq>\n";
$xml .= "</url>\n";
$seo_ind = get_seo_ind();
$query = "SELECT id, name FROM categories;";
database_inquiry($query,$rows);
foreach ($rows as $item)
{
$xml .="<url>\n";
if ($seo_ind)
{
$id = $item['id'];
$xml .=" <loc>http://$_SERVER[HTTP_HOST]/products_{$id}_1.html</loc>\n";
}
else
{
$xml .= htmlspecialchars (" <loc>http://$_SERVER[HTTP_HOST]/product_list.php?category=$item[id]</loc>\n");
}
$xml .=" <priority>$priority</priority>\n";
$xml .=" <changefreq>$freq</changefreq>\n";
$xml .="</url>\n";
}
$query = "SELECT id, url_name, category FROM products;";
database_inquiry($query, $rows);
foreach ($rows as $item)
{
$xml .="<url>\n";
if ($seo_ind)
{
$name = $item['url_name'];
$xml .=" <loc>http://$_SERVER[HTTP_HOST]/product_$name.html</loc>\n";
}
else
{
$xml .= htmlspecialchars (" <loc>http://$_SERVER[HTTP_HOST]/product.php?id=$item[id]&category=$item[category]</loc>\n");
}
$xml .=" <priority>$priority</priority>\n";
$xml .=" <changefreq>$freq</changefreq>\n";
$xml .="</url>\n";
}
$xml .= "</urlset>\n";
header('Content-type: text/xml');
echo $xml;
exit();
?>
require_once('config.php');
require_once('common.php');
$xml = '';
$priority = '0.5';
$freq = 'weekly';
$xml .= "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
$xml .= "<urlset\n";
$xml .= " xmlns=\"http://www.google.com/schemas/sitemap/0.84\"\n";
$xml .= " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n";
$xml .= " xsi:schemaLocation=\"http://www.google.com/schemas/sitemap/0.84\n";
$xml .= " http://www.google.com/schemas/sitemap/0.84/sitemap.xsd\">\n\n";
$xml .= "<url>\n";
$xml .= " <loc>http://$_SERVER[HTTP_HOST]/</loc>\n";
$xml .= " <priority>$priority</priority>\n";
$xml .= " <changefreq>$freq</changefreq>\n";
$xml .= "</url>\n";
$seo_ind = get_seo_ind();
$query = "SELECT id, name FROM categories;";
database_inquiry($query,$rows);
foreach ($rows as $item)
{
$xml .="<url>\n";
if ($seo_ind)
{
$id = $item['id'];
$xml .=" <loc>http://$_SERVER[HTTP_HOST]/products_{$id}_1.html</loc>\n";
}
else
{
$xml .= htmlspecialchars (" <loc>http://$_SERVER[HTTP_HOST]/product_list.php?category=$item[id]</loc>\n");
}
$xml .=" <priority>$priority</priority>\n";
$xml .=" <changefreq>$freq</changefreq>\n";
$xml .="</url>\n";
}
$query = "SELECT id, url_name, category FROM products;";
database_inquiry($query, $rows);
foreach ($rows as $item)
{
$xml .="<url>\n";
if ($seo_ind)
{
$name = $item['url_name'];
$xml .=" <loc>http://$_SERVER[HTTP_HOST]/product_$name.html</loc>\n";
}
else
{
$xml .= htmlspecialchars (" <loc>http://$_SERVER[HTTP_HOST]/product.php?id=$item[id]&category=$item[category]</loc>\n");
}
$xml .=" <priority>$priority</priority>\n";
$xml .=" <changefreq>$freq</changefreq>\n";
$xml .="</url>\n";
}
$xml .= "</urlset>\n";
header('Content-type: text/xml');
echo $xml;
exit();
?>
Thanks!