二维码
搬瓦工 locvps

帝国官方虽然出了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为你自己的数据表的名字,你有多少个数据表,就重复多少遍。


locvps
评论专区
  • 昵 称必填
  • 邮 箱必填
  • 网 址选填
◎已有 0 人评论
BudgetVM
作者介绍
总干事

总干事

总干事作为本站编辑,主要负责VPS优惠、域名优惠和站长百科三个栏目。
80vps henghost
budgetvm sugarhosts
二维码

分享:

支付宝

微信