给出一个帝国CMS自定义制作sitemap.xml的方法
638 人阅读 | 时间:2020年02月10日 11:21
阿里云服务器 | 腾讯云服务器 | VPS2EZ:老牌低调VPS | ZJI:香港日本美国独服 |
LOCVPS服务周到 | HostKvm低调KVM VPS | 傲游主机:优质VPS | 80VPS:老牌VPS主机 |
搬瓦工:CN2 GIA线路 | CloudCone:性价比高 | JustMySocks科学上网 | RackNerd:超级便宜 |
JustMySocks科学上网 | 好用的宝塔面板 | 购买搬瓦工VPS | 恒创:香港CN2服务器 |
帝国官方虽然出了sitemap插件,但是不是很好用。
下面给出一个自定义制作sitemap.xml的方法。
登陆帝国CMS的后台,然后点击栏目---》点击增加自定义页面
然后改文件名为sitemap.xml
在页面内容区域填写以下代码:
<?='<?xml versiON="1.0" encoding="UTF-8"?>'?> <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> <url> <loc>[!--news.url--]</loc> <lastmod><?=date("Y-m-d");?></lastmod> <changefreq>always</changefreq> <priority>1.0</priority> </url> [e:loop={'select classid,classname,classpath,wburl from [!db.pre!]enewsclass where bclassid=0 and showclass=0 and (classid<>52 and classid<>24) order by myorder',0,24,0}] <?php if(empty($bqr[wburl])) { $sccurl= $public_r[newsurl].$bqr[classpath]; } else { $sccurl= $bqr[wburl]; } ?> <url> <loc><?=$sccurl?>/</loc> <lastmod><?=date("Y-m-d");?></lastmod> <changefreq>daily</changefreq> <priority>0.8</priority> </url> [/e:loop] [e:loop={"select * from [!db.pre!]ecms_news order by newstime DESC",0,24,0}] <url> <loc><?=$bqsr[titleurl]?></loc> <lastmod><?=date('Y-m-d',$bqr[newstime])?></lastmod> <changefreq>never</changefreq> <priority>0.5</priority> </url> [/e:loop] [e:loop={"select * from [!db.pre!]ecms_download order by newstime DESC",0,24,0}] <url> <loc><?=$bqsr[titleurl]?></loc> <lastmod><?=date('Y-m-d',$bqr[newstime])?></lastmod> <changefreq>daily</changefreq> <priority>0.8</priority> </url> [/e:loop] [e:loop={"select * from [!db.pre!]ecms_jianzhu order by newstime DESC",0,24,0}] <url> <loc><?=$bqsr[titleurl]?></loc> <lastmod><?=date('Y-m-d',$bqr[newstime])?></lastmod> <changefreq>daily</changefreq> <priority>0.8</priority> </url> [/e:loop] [e:loop={"select * from [!db.pre!]ecms_jiegou order by newstime DESC",0,24,0}] <url> <loc><?=$bqsr[titleurl]?></loc> <lastmod><?=date('Y-m-d',$bqr[newstime])?></lastmod> <changefreq>daily</changefreq> <priority>0.8</priority> </url> [/e:loop] [e:loop={"select * from [!db.pre!]ecms_jsps order by newstime DESC",0,24,0}] <url> <loc><?=$bqsr[titleurl]?></loc> <lastmod><?=date('Y-m-d',$bqr[newstime])?></lastmod> <changefreq>never</changefreq> <priority>0.5</priority> </url> [/e:loop] [e:loop={"select * from [!db.pre!]ecms_cntf order by newstime DESC",0,24,0}] <url> <loc><?=$bqsr[titleurl]?></loc> <lastmod><?=date('Y-m-d',$bqr[newstime])?></lastmod> <changefreq>never</changefreq> <priority>0.5</priority> </url> [/e:loop] [e:loop={"select * from [!db.pre!]ecms_dianqi order by newstime DESC",0,24,0}] <url> <loc><?=$bqsr[titleurl]?></loc> <lastmod><?=date('Y-m-d',$bqr[newstime])?></lastmod> <changefreq>never</changefreq> <priority>0.5</priority> </url> [/e:loop] [e:loop={"select * from [!db.pre!]ecms_fjyl order by newstime DESC",0,24,0}] <url> <loc><?=$bqsr[titleurl]?></loc> <lastmod><?=date('Y-m-d',$bqr[newstime])?></lastmod> <changefreq>never</changefreq> <priority>0.5</priority> </url> [/e:loop] [e:loop={"select * from [!db.pre!]ecms_ct order by newstime DESC",0,24,0}] <url> <loc><?=$bqsr[titleurl]?></loc> <lastmod><?=date('Y-m-d',$bqr[newstime])?></lastmod> <changefreq>never</changefreq> <priority>0.5</priority> </url> [/e:loop] [e:loop={"select * from [!db.pre!]ecms_tuji order by newstime DESC",0,24,0}] <url> <loc><?=$bqsr[titleurl]?></loc> <lastmod><?=date('Y-m-d',$bqr[newstime])?></lastmod> <changefreq>never</changefreq> <priority>0.5</priority> </url> [/e:loop] </urlset>
取其中一节说一下
[e:loop={"select * from [!db.pre!]ecms_tuji order by newstime DESC",0,24,0}]
<url>
<loc><?=$bqsr[titleurl]?></loc>
<lastmod><?=date('Y-m-d',$bqr[newstime])?></lastmod>
<changefreq>never</changefreq>
<priority>0.5</priority>
</url>
[/e:loop]
这是一个数据表的方法,[!db.pre!]ecms_tuji这个字段中的tuji为你自己的数据表的名字,你有多少个数据表,就重复多少遍。
评论专区