destoon7.0模块地图单独输出sitemap.xml

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

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

代码为:

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

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

xmlrss.inc.php

 代码为:

<?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>';
?>

然后在伪静态下新增:

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

这样就搞定了

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

文章转自:destoon7.0新增模块地图destoon7.0新增模块地图今天给大家带来的是destoon7.0新增模块地图,并且输出热门搜索tag,首先在feed目录下新建一个xml.phphttp://www.kaotop.com/it/260586.html

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值