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% [?]
Like this post? Subscribe to my RSS feed and get loads more!




























4 comments
XML Sitemap Pligg Modules - Invalid Date | videositemap.com on April 16, 2008 at 6:09 am
[...] Original post by sitemap - Google News [...]
Jamie Shiller on April 18, 2008 at 6:49 am
Thanks very much for this solution! I didn’t expect to find it so quick on the Pligg forum
I’ll let you know if I get stuck.
-Jamie
Pliggs on April 28, 2008 at 1:45 am
Perfect, thanks for posting the solution.
XML Sitemap Pligg Modules - Invalid Date | Pliggs on April 28, 2008 at 1:50 am
[...] Get the fix here… [...]