but unfortunately, it don't have Google site map function.
After several hours of trying to find such a module, I give up, and try to develop by myself. I have to say one thing, I have never learnt PHP before, although I have learnt Jsp, Asp. So, at the beginning, I looked into another forum's google site map modules, and finally I develpe USebb's Google sitemap according to that forum.
it's hard for me to use English to describe the whole thing,
My forum is a Chinese tea forum, http://forum.teainchina.biz
it's tea and tea culture in China
Below is the code I use, you I named this file as generate_sitemap.php
everytime I need to update the sitemap, then I visite this page,
and it automatically create the sitemap file, the sitemap index file is created on the root path of you forum,
named "sitemap_index.xml", you can simply submit it to google under the google webmaster tool.
you can see my example http://forum.teainchina.biz/sitemap_index.xml
Hope this could help some of you.
<?php
define('INCLUDED', true);
define('ROOT_PATH', './');
//
// Include usebb engine
//
require(ROOT_PATH.'sources/common.php');
$sumurl = 1000000;
$perpageurl = 500;
$timezone = '08:00';
$updatingfre = 'daily';
$googlepower = 0.7;
$sitemaptop = '<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.google.com/schemas/sitemap/0.84">
';
$urlchar = '<url>
<loc>';
$locchar ='</loc>
<lastmod>';
$lastmad ='</lastmod>
<changefreq>';
$changefreq = '</changefreq>
<priority>';
$priority = '</priority>
</url>
';
$sitemapbot = '</urlset>';
$indextop = '<?xml version="1.0" encoding="UTF-8"?>
<sitemapindex xmlns="http://www.google.com/schemas/sitemap/0.84">
';
$indexsitemap = '<sitemap>
<loc>';
$indexloc = '</loc>
<lastmod>';
$indexlastmod ='</lastmod>
</sitemap>
';
$indexbot = '</sitemapindex>';
$boardurl = $functions->get_config('board_url');
//generate number of sitmap files
$result = $db->query("SELECT count(id) as topicsnum FROM ".TABLE_PREFIX."topics ");
$out = $db->fetch_result($result);
$num = $out['topicsnum'];
if ($sumurl > $num ){
$sumurl = $num;
}
$pagenum = intval($sumurl/$perpageurl);
$pagenumber = $pagenum;
if ( $pagenum < ($sumurl/$perpageurl)){
$pagenumber = $pagenum + 1;
}
$makemapdate = getdate();
$makemapdate = gmdate ("Y-m-d",$makemapdate[0])."T".gmdate ("H:i:s",$makemapdate[0])."+".$timezone;
//sitmap index file.
$indexmaptop = fopen("sitemap_index.xml", "w");
fwrite($indexmaptop, $indextop);
fclose($indexmaptop);
for ($i=1; $i <= $pagenumber ; $i++){
$indexhtml = $boardurl."sitemap_$i.xml";
$indexcontent = "$indexsitemap$indexhtml$indexloc$makemapdate$indexlastmod";
$indexmap = fopen("sitemap_index.xml", "a");
fwrite($indexmap, $indexcontent);
fclose($indexmap);
}
$indexmapbot = fopen("sitemap_index.xml", "a");
fwrite($indexmapbot, $indexbot);
fclose($indexmapbot);
$outsitemapindex = $boardurl."sitemap_index.xml";
//site maps .
$result = $db->query("SELECT t.id, max(p.post_time) as post_time from ".TABLE_PREFIX."topics t," .TABLE_PREFIX."posts p group by t.id order by id desc");
for ($j=1;$j<=$pagenum; $j++) {
$maptop = fopen("sitemap_$j.xml", "w");
fwrite($maptop, $sitemaptop);
fclose($maptop);
for ($i=0;$i<$perpageurl; $i++){
$out = $db->fetch_result($result);
$ab[$i]= $out;
$lastdateline = gmdate ("Y-m-d",$ab[$i]['post_time'])."T".gmdate ("H:i:s",$ab[$i]['post_time'])."+".$timezone;
$url = $boardurl."topic-".$ab[$i]['id'].".html";
$urlmap = "$urlchar$url$locchar$lastdateline$lastmad$updatingfre$changefreq$googlepower$priority";
$mapurl = fopen("sitemap_$j.xml", "a");
fwrite($mapurl, $urlmap);
fclose($mapurl);
}
$mapbot = fopen("sitemap_$j.xml", "a");
fwrite($mapbot, $sitemapbot);
fclose($mapbot);
$outsitemap[$j] = $boardurl."sitemap_$j.xml" ;
}
if ($pagenumber > $pagenum ){
$exurl = $sumurl-$pagenum*$perpageurl;
$maptop = fopen("sitemap_$pagenumber.xml", "w");
fwrite($maptop, $sitemaptop);
fclose($maptop);
for ($i=0;$i<$exurl; $i++){
$out = $db->fetch_result($result);
$ab[$i]= $out;
$lastdateline = gmdate ("Y-m-d",$ab[$i]['post_time'])."T".gmdate ("H:i:s",$ab[$i]['post_time'])."+".$timezone;
$url = $boardurl."thread-".$ab[$i]['id'].".html";
$urlmap = "$urlchar$url$locchar$lastdateline$lastmad$updatingfre$changefreq$googlepower$priority";
$mapurl = fopen("sitemap_$pagenumber.xml", "a");
fwrite($mapurl, $urlmap);
fclose($mapurl);
}
$mapbot = fopen("sitemap_$pagenumber.xml", "a");
fwrite($mapbot, $sitemapbot);
fclose($mapbot);
$outsitemap[$pagenumber] = $boardurl."sitemap_$pagenumber.xml" ;
}
for ($i=1;$i<=$pagenumber; $i++){
echo $outsitemap[$i];
}
?>

