新建一个自定义页面.定义路径为: /sitemap.xml
自定义页面内容为:
<?='<?xml version="1.0" encoding="UTF-8"?>'?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>[!--news.url--]</loc>
<priority>1.000</priority>
</url>
[e:loop={"select * from [!db.pre!]enewsclass where checked=1 order by classid",0,24,0}]
<url>
<loc><?=$public_r[newsurl]?><?=$bqr[classpath]?>/</loc>
<priority>0.5000</priority>
</url>
[/e:loop]
[e:loop={"select * from [!db.pre!]enewszt order by ztid",0,24,0}]
<url>
<loc><?=$public_r[newsurl]?><?=$bqr[ztpath]?>/</loc>
<priority>0.5000</priority>
</url>
[/e:loop]
[e:loop={"select * from [!db.pre!]ecms_news where checked=1 order by newstime",0,24,0}]
<url>
<loc><?=$bqsr[titleurl]?></loc>
<priority>0.5000</priority>
</url>
[/e:loop]
</urlset>
如果有多个表,则继续,把[!db.pre!]ecms_news,改成相应的表名.
[e:loop={"select * from [!db.pre!]ecms_表名 where checked=1 order by newstime",0,24,0}]
<url>
<loc><?=$bqsr[titleurl]?></loc>
<priority>0.5000</priority>
</url>
[/e:loop]
-----------------------------
以下是另外一个的修正版本
页面内容如下:
<?='<?xml version="1.0" encoding="UTF-8"?>'?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>[!--news.url--]</loc>
<priority>1.000</priority>
</url>
[e:loop={"select * from [!db.pre!]enewsclass order by classid limit 1000",1000,24,0}]
<url>
<loc><?=$public_r[newsurl]?><?=$bqr[classpath]?>/</loc>
<changefreq>daily</changefreq>
<priority>0.8000</priority>
</url>
[/e:loop]
[e:loop={"select * from [!db.pre!]ecms_news order by newstime desc limit 50000",0,24,0}]
<url>
<loc><?=$bqsr[titleurl]?></loc>
<lastmod><?=format_datetime($bqr[newstime],'Y-m-d')?></lastmod>
<priority>0.5000</priority>
</url>
[/e:loop]
</urlset>