您现在的位置是:网站首页> 编程资料编程资料
dedecms实现仿downkr的sitemap效果代码_dedecms_
2023-05-27
379人已围观
简介 dedecms实现仿downkr的sitemap效果代码_dedecms_
修改的是dedecms目录下的/include/inc_sitemap.php文件
//class SiteMap
//--------------------------------
require_once(dirname(__FILE__)."/config_base.php");
require_once(dirname(__FILE__)."/inc_channel_unit_functions.php");
class SiteMap
{
var $dsql;
var $artDir;
var $baseDir;
//-------------
//php5构造函数
//-------------
function __construct()
{
$this->idCounter = 0;
$this->artDir = $GLOBALS['cfg_arcdir'];
$this->baseDir = $GLOBALS['cfg_cmspath'].$GLOBALS['cfg_basedir'];
$this->idArrary = "";
$this->dsql = new DedeSql(false);
}
function SiteMap()
{
$this->__construct();
}
//------------------
//清理类
//------------------
function Close()
{
$this->dsql->Close();
}
//---------------------------
//获取网站地图
//$maptype = "site" 或 "rss"
//---------------------------
function GetSiteMap($maptype="site")
{
$mapString = "
复制代码 代码如下:
//class SiteMap
//--------------------------------
require_once(dirname(__FILE__)."/config_base.php");
require_once(dirname(__FILE__)."/inc_channel_unit_functions.php");
class SiteMap
{
var $dsql;
var $artDir;
var $baseDir;
//-------------
//php5构造函数
//-------------
function __construct()
{
$this->idCounter = 0;
$this->artDir = $GLOBALS['cfg_arcdir'];
$this->baseDir = $GLOBALS['cfg_cmspath'].$GLOBALS['cfg_basedir'];
$this->idArrary = "";
$this->dsql = new DedeSql(false);
}
function SiteMap()
{
$this->__construct();
}
//------------------
//清理类
//------------------
function Close()
{
$this->dsql->Close();
}
//---------------------------
//获取网站地图
//$maptype = "site" 或 "rss"
//---------------------------
function GetSiteMap($maptype="site")
{
$mapString = "
- ";
- ".$row->typename."
"."
\r\n"; - ".$row->typename." ";
if($maptype=="rss") $this->dsql->SetQuery("Select ID,typedir,isdefault,defaultname,typename,ispart,namerule2 From #@__arctype where ishidden<>1 And reID=0 And ispart<>2 order by sortrank");
else $this->dsql->SetQuery("Select ID,typedir,isdefault,defaultname,typename,ispart,namerule2 From #@__arctype where reID=0 And ishidden<>1 order by sortrank");
$this->dsql->Execute(0);
while($row=$this->dsql->GetObject(0))
{
if($maptype=="site") $typelink = GetTypeUrl($row->ID,MfTypedir($row->typedir),$row->isdefault,$row->defaultname,$row->ispart,$row->namerule2);
else $typelink = $GLOBALS['cfg_plus_dir']."/rss/".$row->ID.".xml";
$mapString .= "
$mapString .= $this->LogicListAllSunType($row->ID,$maptype,0);
}
$mapString .= "";
return $mapString;
}
//获得子类目的递归调用
function LogicListAllSunType($ID,$maptype,$pd)
{
$fid = $ID;
$mapString = "";
$pd = $pd + 15;
if($maptype=="rss") $this->dsql->SetQuery("Select ID,typedir,isdefault,defaultname,typename,ispart,namerule2 From #@__arctype where reID='".$ID."' And ishidden<>1 And ispart<>2 order by sortrank");
else $this->dsql->SetQuery("Select ID,typedir,isdefault,defaultname,typename,ispart,namerule2 From #@__arctype where reID='".$ID."' And ishidden<>1 order by sortrank");
$this->dsql->Execute($fid);
$mapString .= "";
while($row=$this->dsql->GetObject($fid))
{
if($maptype=="site") $typelink = GetTypeUrl($row->ID,MfTypedir($row->typedir),$row->isdefault,$row->defaultname,$row->ispart,$row->namerule2);
else $typelink = $GLOBALS['cfg_plus_dir']."/rss/".$row->ID.".xml";
$lastLink = "
$mapString .= $lastLink;
$mok = $this->LogicListAllSunType($row->ID,$maptype,$pd);
if(ereg(" //$mapString = str_replace($lastLink,"
$lastLink",$mapString);
$mapString .= $mok;
}
}
$mapString .= "\r\n";
return $mapString;
}
}
?>
$mapString .= $mok;
}
}
$mapString .= "\r\n";
return $mapString;
}
}
?>
您可能感兴趣的文章:
相关内容
- dedecms 自由列表调用代码_dedecms_
- 实现dedecms图集单击图片翻页的功能_整站程序_
- 科汛V4.5伪静态的实现正则规则_科讯相关_
- kesion 科讯不用登录实现digg的修改方法_科讯相关_
- 动易开源PowerEasy® SiteWeaver™ 6.5系列产品发布免费下载了[原创]_整站程序_
- DEDE 4.0 自动采集源文件 提供了_整站程序_
- 全面优化V4.0及AJAX标签使用技巧_科讯相关_
- 用科讯4.0发现的一些缩略图的bug_科讯相关_
- 科讯4.0 频道导航调用_科讯相关_
- 列出KesionCMS 4.0系统后台菜单,让大家熟悉下_科讯相关_
点击排行
本栏推荐
