PDA

View Full Version : Help with site map



tgallagher26
03-02-2009, 08:20 PM
Ok so according to Google your sitemap shoul be as follows.

I need help with the Lastmod tag


<url>
<loc>http://www.example.com/</loc>
<lastmod>2005-01-01</lastmod>
<changefreq>monthly</changefreq>
<priority>0.8</priority>
</url>

My current function is like this.


function genSiteMap() {
global $baza, $clear;
$xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<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\">\n";
$xml .= "\t<url>\n\t\t<loc>" . ROOT . "</loc>\n\t\t";
$xml .= "<priority>1</priority>\n\t\t";
$xml .= "<changefreq>" . $clear . "</changefreq>\n\t";
$xml .= "</url>\n";
$xml .= "\t<url>\n\t\t<loc>" . ROOT . "index.php</loc>\n\t\t";
$xml .= "<priority>0.9</priority>\n\t\t";
$xml .= "<changefreq>" . $clear . "</changefreq>\n\t";
$xml .= "</url>\n";
$sql = "SELECT query, cat FROM cache";
$baza -> izvrsiUpit($sql);
$baza -> stvoriNiz();
while($red = $baza -> noviRed()) {
$xml .= "\t<url>\n\t\t<loc>" . ROOT . "txt/1/10/" . urlencode($red["query"]) . ".html</loc>\n\t\t";
$xml .= "<priority>0.8</priority>\n\t\t";
$xml .= "<changefreq>" . $clear . "</changefreq>\n\t";
$xml .= "</url>\n";
}
$xml .= "</urlset>";
file_put_contents('sitemap.xml', $xml);
}


Which doesnt include the lastmod tag.

Can anyone help me add it?

Tim..

Nile
03-02-2009, 10:37 PM
That part is optional, but to help you we would need to see an example, and a database structure please.