今天给大家带来的是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('&',?'&',?$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
|