$dsql->execute($ID);
while($row_class = $dsql->getarray($ID)){
ShowMsg($ID);
$SonClass .= "\n";
$iClassUrl = $tl->GetOneTypeUrl($row_class);
$iClassUrl = count(explode("http://",$iClassUrl))>1 ? $iClassUrl: $cfg_basehost.$iClassUrl;
$SonClass .= "".$iClassUrl."\n";
$SonClass .= "".date("Y-m-d",time())."T".date("H:i:s+08:00",time())."\n";
$SonClass .= "daily\n";
$SonClass .= "0.9\n";
$SonClass .= "\n";
getSonClass($row_class["id"]);
}
return $SonClass;
}
function MK_Dir($path,$pathname){
if(!file_exists($path)){
createDir(dirname($path));
mkdir($path, 0775);
ShowMsg("成功创建目录".$pathname,"javascript:;");
}
}
if(empty($dopost)){
include DEDEADMIN.'/templets/google_sitemap.htm';
}else if($dopost=="make"){
//取得数目
$dsql->SetQuery("Select count(*) as mycount from `#@__archives` where ismake=1");
$dsql->execute();
$row_sum = $dsql->getarray();
if(($sumurl > $row_sum['mycount']) || empty($sumurl)){
$sumurl = $row_sum['mycount'];
}
$pagenum = intval($sumurl/$perpageurl);
$pagenumber = $pagenum;
if($pagenum \n";
$sitemap_index .= "\n";
for($i=0; $i \n";
$sitemap_index .= "".$cfg_basehost."/sitemap/sitemap_$i.xml\n";
$sitemap_index .= "".date("Y-m-d",time())."T".date("H:i:s+08:00",time())."\n";
$sitemap_index .= "\n";
}
$sitemap_index .= "";
$indexmap = fopen(dirname(__FILE__)."/../".$filename."/sitemap_index.xml", "w");
fwrite($indexmap, $sitemap_index);
fclose($indexmap);
ShowMsg("成功生成地图索引:/".$filename."/sitemap_index.xml","javascript:;");
//首页、栏目列表sitemap_0.xml
$sitemap_1 = "\n";
$sitemap_1 .= "\n";
$sitemap_1 .= "\n";
$sitemap_1 .= "".$cfg_basehost."/\n";
$sitemap_1 .= "".date("Y-m-d",time())."T".date("H:i:s+08:00",time())."\n";
$sitemap_1 .= "always\n";
$sitemap_1 .= "1.0\n";
$sitemap_1 .= "\n";
$dsql->SetQuery("Select id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath from `#@__arctype` where ishidden1 order by id,sortrank");
$dsql->execute();
while($row_type = $dsql->getarray()){
$sitemap_1 .= "\n";
$iTypeUrl = $tl->GetOneTypeUrl($row_type);
$iTypeUrl = count(explode("http://",$iTypeUrl))>1 ? $iTypeUrl : $cfg_basehost.$iTypeUrl;
$sitemap_1 .= "".$iTypeUrl."\n";
$sitemap_1 .= "".date("Y-m-d",time())."T".date("H:i:s+08:00",time())."\n";
$sitemap_1 .= "daily\n";
$sitemap_1 .= "0.9\n";
$sitemap_1 .= "\n";
//$sitemap_1 .= getSonClass($row_type["id"]);
}
$sitemap_1 .= "";
$classmap = fopen(dirname(__FILE__)."/../".$filename."/sitemap_0.xml", "w");
fwrite($classmap, $sitemap_1);
fclose($classmap);
ShowMsg("成功生成首页、栏目列表地图:/".$filename."/sitemap_0.xml","javascript:;");
//所有文章sitemap_(1-*).xml
$limit_st = 0;
for($page_num=1; $page_num\n";
$sitemap .= "\n";
$query = "Select arc.*,tp.typedir,tp.typename,tp.isdefault,tp.defaultname,tp.namerule,tp.namerule2,tp.ispart,tp.moresite,tp.siteurl,tp.sitepath
from `#@__archives` arc LEFT JOIN `#@__arctype` tp ON arc.typeid=tp.id
where arc.ismake=1 order by pubdate limit $limit_st,$perpageurl";
$dsql->SetQuery($query);
$dsql->execute();
while($row_url = $dsql->getarray()){
//自动识别动态页和静态页
$row_url["arcurl"] = GetFileUrl($row_url["id"],$row_url["typeid"],$row_url["senddate"],$row_url["title"],$row_url["ismake"],$row_url["arcrank"],$row_url["namerule"],$row_url["typedir"],$row_url["money"],$row_url['filename'],$row_url["moresite"],$row_url["siteurl"],$row_url["sitepath"]);
$row_url["fullurl"] = $cfg_basehost.$row_url["arcurl"];
if($GLOBALS['cfg_multi_site'] == 'Y') $row_url["fullurl"] = $row_url["arcurl"];
$link = $row_url["fullurl"];
$times = $row_url['senddate'] ;
$lastmodified=date("Y-m-d",$times)."T".date("H:i:s+08:00",$times);
//生成更新频率和更新指数
$priority="0.8";
//生成sitemap
$sitemap .= "\n";
$sitemap .= "$link\n";
$sitemap .= "$lastmodified\n";
$sitemap .= "$changefreq\n";
$sitemap .= "$priority\n";
$sitemap .= "\n";
}
$sitemap .= "";
$urlmap = fopen(dirname(__FILE__)."/../".$filename."/sitemap_".$page_num.".xml","w");
fwrite($urlmap,$sitemap);
fclose($urlmap);
ShowMsg("成功生成文章列表地图:/".$filename."/sitemap_".$page_num.".xml
共".$row_sum['mycount']."条记录,每页".$perpageurl."条,当前".$page_num."/".$pagenumber."页","javascript:;");
$limit_st = $limit_st + $perpageurl;
}
ShowMsg("全部生成成功!","javascript:;");
exit();
}
?>
生成老是会卡住。。大概一百多万条数据。。