Thanks to mihai from PatchLog for providing XML Sitemap for Pligg update 0.6. I installed it for my pligg 9.9.0 powered site at http://pligg.topsites.sg running on php 4.

However when submitting the sitemap to Google, the date was an invalid format. The sitemap lastmod date was showing <lastmod>2008-04-16SGT10:23:16</lastmod>

According to Google Sitemap FAQ, Google Sitemap requires the ISO-8601 encoding which has two variations:
- 2005-02-21
- 2005-02-21T18:00:15+00:00

After some research, i found the solution. Thanks to Guides - Dynamic ATOM Feed

Open xml_sitemaps_main.php

Before

function xml_sitemaps_show_sitemap(){,

Add

function get_iso_8601_date($int_date) {
//$int_date: current date in UNIX timestamp
$date_mod = date(’Y-m-d\TH:i:s’, $int_date);
$pre_timezone = date(’O', $int_date);
$time_zone = substr($pre_timezone, 0, 3).”:”.substr($pre_timezone, 3, 2);
$date_mod .= $time_zone;
return $date_mod;
}

Find

echo “<lastmod>”.date(’Y-m-dTH:i:s’,strtotime($r[0])).”</lastmod>”;

Replace with

// echo “<lastmod>”.date(’Y-m-dTH:i:s’,strtotime($r[0])).”</lastmod>”;
echo “<lastmod>”.get_iso_8601_date(strtotime($r[0])).”</lastmod>”;

Find

echo “<lastmod>”.date(’Y-m-dTH:i:s’, $link->modified).”</lastmod>\n”;

Replace with

// echo “<lastmod>”.date(’Y-m-dTH:i:s’, $link->modified).”</lastmod>\n”;
echo “<lastmod>”.get_iso_8601_date($link->modified).”</lastmod>”;

Find

echo “<lastmod>”.date(’Y-m-dTH:i:s’, $m_time).”</lastmod>\n”;

Replace with

// echo “<lastmod>”.date(’Y-m-dTH:i:s’, $m_time).”</lastmod>\n”;
echo “<lastmod>”.get_iso_8601_date($m_time).”</lastmod>”;

That’s all you need. Submit it to Google and it should accept your Sitemap.

Popularity: 4% [?]

Share and Enjoy:
  • E-mail this story to a friend!
  • YahooMyWeb
  • Google
  • Facebook
  • StumbleUpon
  • Technorati
  • del.icio.us
  • Fark
  • Reddit
  • Mixx
  • BlinkList
  • NewsVine
  • Wikio
  • Furl
  • Netvouz
  • Simpy
  • Bumpzee
  • MisterWong
  • Ma.gnolia
  • Global Grind
  • Spurl
  • Pownce
  • Socialogs
  • LinkaGoGo
  • TwitThis
  • Blogsvine
  • Smarking
  • ppnow

You Should Also Check Out This Post:

More Active Posts: