destoon7.0新增模块地图,自动输出当前模块的地图

       

今天给大家带来的是destoon7.0新增模块地图,并且输出热门搜索tag

 首先在feed目录下新建一个xml.php

代码为:

1
2
3
4
5
6
<?php
define('DT_NONUSER', true);
$moduleid = 3;
require '../common.inc.php';
require DT_ROOT.'/module/'.$module.'/xmlrss.inc.php';
?>

 然后在module/extend/目录下新增一个

1
xmlrss.inc.php

 代码为:

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
66
67
68
69
70
71
72
73
74
75
<?php
defined('IN_DESTOON'or exit('Access Denied');
require DT_ROOT.'/module/'.$module.'/common.inc.php';
header("Content-type: text/xml");
header('HTTP/1.1 200 OK');
$mid or $mid = 4;
$areaid = isset($areaid) ? intval($areaid) : 0;
if($mid > 4 && isset($MODULE[$mid]) && !$MODULE[$mid]['islink']) {
    $moduleid $mid;
    $module $MODULE[$mid]['module'];
    $modurl $MODULE[$mid]['linkurl'];
    $table = get_table($mid);
    $rss_title $MODULE[$mid]['name'];
    if($MOD['feed_enable']) {
        $pagesize $MOD['feed_pagesize'] ? intval($MOD['feed_pagesize']) : 50;
        $condition "status=3";
        if($MOD['feed_enable'] == 2) {
            if($catid) {
                $condition .= $CAT['child'] ? " and catid IN (".$CAT['arrchildid'].")" " and catid=$catid";
                $rss_title $rss_title.$DT['seo_delimiter'].strip_tags(cat_pos($catid$DT['seo_delimiter']));
            }
            if($areaid) {
                $condition .= $ARE['child'] ? " and areaid IN (".$ARE['arrchildid'].")" " and areaid=$areaid";
                $rss_title $rss_title.$DT['seo_delimiter'].strip_tags(area_pos($areaid$DT['seo_delimiter']));
            }
        }
    }
$rss_title $rss_title.$DT['seo_delimiter'].$DT['sitename'];
$today = timetodate($DT_TIME, 3);
echo  '<?xml version="1.0" encoding="utf-8"?>';
echo  '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">';
        echo  '<url>';
        echo  '<loc>'.$modurl.'</loc>';
        echo  '<lastmod>'.$today.'</lastmod>';
        echo  '<changefreq>hourly</changefreq>';
        echo  '<priority>0.9</priority>';
        echo  '</url>';
 
    if($MOD['feed_enable']) {
        $result $db->query("SELECt itemid,title,introduce,linkurl,addtime FROM {$table} WHERe {$condition} ORDER BY addtime DESC LIMIT 0,$pagesize"'CACHE');
        while($r $db->fetch_array($result)) {
        echo  '<url>';
        echo  '<loc>'.$modurl.str_replace('&''&amp;'$r['linkurl']).'</loc>';
        echo  '<lastmod>'.$today.'</lastmod>';
        echo  '<changefreq>hourly</changefreq>';
        echo  '<priority>0.9</priority>';
        echo  '</url>';
        }
//获取keyword
$keyresult "SELECT letter,word  FROM {$DT_PRE}keyword WHERe  MODULEID=$moduleid ORDER BY itemid ASC  LIMIT $pagesize";
$resultkey$db->query($keyresult);
while ($rk=$db->fetch_array(($resultkey)))
{  
 $keywordId $rk['letter'];  //获取拼音
 $linkkeyurl $modurl."tags/"$keywordId.".html";//定义模块URL
        echo  '<url>';
        echo  '<loc>'.$linkkeyurl.'</loc>';
        echo  '<lastmod>'.$today.'</lastmod>';
        echo  '<changefreq>hourly</changefreq>';
        echo  '<priority>0.9</priority>';
        echo  '</url>';
}
    else {
echo  '<url>';
echo  '<loc>'.DT_PATH.'</loc>';
echo  '<lastmod>'.$today.'</lastmod>';
echo  '<changefreq>always</changefreq>';
echo  '<priority>1.0</priority>';
echo  '</url>';
    }
else {
    dheader('./');
}
echo  '</urlset>';
?>

 

然后在伪静态下新增:

1
RewriteRule ^(.*)/baidu(.*).xml$  $1/xml.php?mid=$2

这样就搞定了

http://www.kaotop.com/feed/baidu21.xml

http://www.kaotop.com/feed/baidu22.xml

http://www.kaotop.com/feed/baidu23.xml

http://www.kaotop.com/feed/baidu24.xml

http://www.kaotop.com/feed/baidu25.xml

http://www.kaotop.com/feed/baidu26.xml

http://www.kaotop.com/feed/baidu27.xml

http://www.kaotop.com/feed/baidu28.xml

http://www.kaotop.com/feed/baidu29.xml

http://www.kaotop.com/feed/baidu30.xml

http://www.kaotop.com/feed/baidu31.xml

http://www.kaotop.com/feed/baidu32.xml

http://www.kaotop.com/feed/baidu33.xml

http://www.kaotop.com/feed/baidu34.xml

http://www.kaotop.com/feed/baidu36.xml

 
posted @   圆柱模板  阅读(169)  评论(0编辑  收藏  举报
编辑推荐:
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· AI技术革命,工作效率10个最佳AI工具
点击右上角即可分享
微信分享提示