<?PHP/** $ cron_sitemap.php 2012-5-28 Sitemap Planning Task Edition www.zhixiaotang.com*/if(!defined(' In_discuz ')) { Exit(' Access Denied ');}$filename= ' Sitemap.xml ';//The following five items can be changed according to the specific situation$cfg _updateperi= ' 60 ';//maximum protocol file update cycle, in minutes$web _root=$_g[' SiteURL '];//root URL$CHARSET= ' GBK ';//or Utf-8//Select the encoding method/***********************************************************************************************///Site Map Sitemap.xml$sitemap= "<?xml version=\" 1.0\ "encoding=\" gb2312\ "? >\n";$sitemap. = "<urlset\n";$sitemap. = "xmlns=\" http://www.sitemaps.org/schemas/sitemap/0.9\ "\ n";$sitemap. = "xmlns:xsi=\" http://www.w3.org/2001/xmlschema-instance\ "\ n";$sitemap. = "Xsi:schemalocation=\" http://www.sitemaps.org/schemas/sitemap/0.9\n ";$sitemap. = "Http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd\" >\n "; $querys= Db::query ("Select A.tid from". Db::table (' Forum_thread '). "A INNER join". Db::table (' Forum_forum '). "B on A.fid=b.fid ORDER by A.tid DESC LIMIT 0,10000"); while($threadfid= Db::fetch ($querys)) { $turl=$web _root.‘ Thread-'.$threadfid[' Tid ']. ' -1-1.html ';//Note static Rules $link=$turl; $t= Time(); $riqi=Date("Y-m-d",$t); $priority=Rand(1,10)/10;//Date ("D F D Y", $t);$sitemap. = "<url>\n";$sitemap. = "<loc>$link</loc>\n ";$sitemap. = "<priority>$priority</priority>\n ";$sitemap. = "<lastmod>$riqi</lastmod>\n ";$sitemap. = "<changefreq>weekly</changefreq>\n";$sitemap. = "</url>\n"; } $sitemap. = "</urlset>\n"; $fp=fopen(Discuz_root. ' /‘.$filename, ' W '); fwrite($fp,$sitemap); fclose($fp);?>
Web version
<?PHP/*Íøõ¾µøí¼íøò³°ægbk±àâë*/Define(' Apptypeid ', 127);Define(' Curscript ', ' sitemap ');require'./source/class/class_core.php ';$discuz= & Discuz_core::instance ();$discuz->cachelist =$cachelist;$discuz-init ();$urlnum= 100;//Íøö Êý$navtitle= ' Íøõ¾µøí¼ ';$metakeywords=$_g[' Seokeywords '] [' Forum '];$metadescription=$_g[' Bbname '].$_g[' Seodescription '] [' Forum '];includeTemplate (' Common/header ');Echo' <div style= ' height:1400px ' > ';Echo' <style type= ' text/css ' >.newtid{width:100%;float:left}.newtid li{padding-left:2%;font-size:14px;width:48%; float:left;line-height:25px;}. Newtid Li A{color: #036;}. Newtit strong a{position:absolute;bottom:98765px;}. Newtid h2{font-size:16px;line-height:45px;} </STYLE><H2 class= "Newtit" ><a href= "" >xîðâ ¢±íµäìûxó:</a>;$querys= Db::query ("Select A.tid,a.subject,a.fid,b.name from". Db::table (' Forum_thread '). "A INNER join". Db::table (' Forum_forum '). "B on A.fid=b.fid where A.displayorder!=-2 ORDER by A.tid DESC LIMIT 0,$urlnum");$i= 0; while($threadfid= Db::fetch ($querys)) {$i++; Echo' <li class= ' newsitemap ' > '.$i.‘ ¡¢<a href= "forum.php?mod=forumdisplay&fid=".$threadfid[' FID ']. ' " Title= "'.$threadfid[' name ']. ' " target= "_blank" >['.$threadfid[' Name ']. </a> <a href= "forum.php?mod=viewthread&tid=".$threadfid[' Tid ']. ' " target= "_blank" title= "'.$threadfid[' Subject ']. ' " > '.$threadfid[' Subject ']. ' </a></li> '; }Echo' </ul> ';Echo' </div> '; includeTemplate (' Common/footer ');?>
Discuz Sitemap Generation Code