帝国cms站点地图html或xml的增加方法以及代码

首先在帝国cms后台【栏目】——【自定义页面】——【增加自定义页面】添加模板,如下图:

2、站点地图调用代码

1

2

3

4

<div class="w sitemap">

                  <h2>站点地图</h2>

                [listshowclass]'0',1,1,0[/listshowclass]

</div>

1

[listshowclass]'0',1,1,0[/listshowclass]

说明:调用所有一级栏目导航,使用标签模板ID=1的模板(第二个1),并且显示记录数(第三个1)。

3、在【模板】——【标签模板】——【管理标签模板】把ID为1的模板改为如下代码:

页面模板内容(*)

1

2

3

4

5

6

7

8

9

10

11

12

<table  align="center" border="0" cellpadding="3" cellspacing="1" bgcolor="ffcc00">

  <tr>

    <td><b><a href="[!--bclassurl--]">[!--bclassname--]</a> <font color="#666666">(信息数:[!--bnum--])</font></b></td>

  </tr>

  <tr>

    <td bgcolor="#ffffff">

[!--empirenews.listtemp--]

<!--list.var1-->

[!--empirenews.listtemp--]

    </td>

  </tr>

</table>


列表内容模板(list.var) (*)

1

<a href="[!--classurl--]">[!--classname--]</a> <font color="#666666">(信息数:[!--num--])</font>

进阶版:

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

60

61

62

63

64

65

<?='<?xml version="1.0" encoding="utf-8"?>'?>

<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">

    <url>

        <loc>[!--news.url--]</loc>

        <changefreq>always</changefreq>

        <priority>1.0</priority>

    </url>

<?php

  

$sql=$empire->query('select classid,bclassid,classname,classpath,wburl,islast from '.$dbtbpre.'enewsclass  order by myorder, classid asc ');

for($i=1;$cr=$empire->fetch($sql);$i++)

{

    $r[$i]=$cr;//select出的数据储存到数组

}

  

for($i=1;$r[$i];$i++)

{

    if($r[$i][bclassid]==0)//选出一级栏目

    {

        echo '<url>

        <loc>'.$public_r[newsurl].''.($r[$i][classpath]==''?$r[$i][wburl]:''.$r[$i][classpath]).'/</loc>

        <changefreq>daily</changefreq>

        <priority>0.95</priority>

    </url>';

          

        if($r[$i][islast]==0&&$r[$i][wburl]=='')//选出非终极栏目

        {  

            for($j=1;$r[$j];$j++)//循环数组一次

                if($r[$j][bclassid]==$r[$i][classid] && $r[$j][islast]!=0)//选出二级栏目

                {

                    echo '<url>

        <loc>'.$public_r[newsurl].''.($r[$j][classpath]==''?$r[$j][wburl]:''.$r[$j][classpath]).'/</loc>

        <changefreq>daily</changefreq>

        <priority>0.9</priority>

    </url>';

                }else{

                    if($r[$j][bclassid]==$r[$i][classid])//选出三级栏目

                    {

                        echo '<url>

        <loc>'.$public_r[newsurl].''.($r[$j][classpath]==''?$r[$j][wburl]:''.$r[$j][classpath]).'/</loc>

        <changefreq>daily</changefreq>

        <priority>0.9</priority>

    </url>';

                        for($k=1;$r[$k];$k++)//循环数组一次

                            if($r[$k][bclassid]==$r[$j][classid])

                                echo '<url>

        <loc>'.$public_r[newsurl].''.($r[$k][classpath]==''?$r[$k][wburl]:''.$r[$k][classpath]).'/</loc>

        <changefreq>daily</changefreq>

        <priority>0.9</priority>

    </url>';

                    }

                }

        }

    }

}

?>

    [e:loop={0,30000,3,0,'','newstime DESC'}]

    <url>

        <loc><?=$bqsr['titleurl']?></loc>

        <lastmod><?=date('Y-m-d',$bqr[newstime])?></lastmod>

        <changefreq>weekly</changefreq>

        <priority>0.8</priority>

    </url>

    [/e:loop]

</urlset>

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

执刀人的工具库

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值