DEDECMS implementation of DOWNKR sitemap effect code _DEDECMS

Source: Internet
Author: User
Modified is the/include/inc_sitemap.php file in the Dedecms directory
Copy Code code as follows:

<?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 constructors
//-------------
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 ();
}
//------------------
Cleaning class
//------------------
function Close ()
{
$this->dsql->close ();
}
//---------------------------
Get site Map
$maptype = "Site" or "RSS"
//---------------------------
function Getsitemap ($maptype = "Site")
{
$mapString = "<DL>";
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. = "<dl><dt><span><a href= ' $typelink ' >". $row->typename. " </a></span><a href= ' yun_qi_img/rss.gif ' > '. </a></dt>\r\n ";
$mapString. = $this->logiclistallsuntype ($row->id, $maptype, 0);
}
$mapString. = "";
return $mapString;
}
Recursive call to get subclass purpose
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 = "<dd><a href= ' $typelink ' >". $row->typename. " </a></DD> ";
$mapString. = $lastLink;
$mok = $this->logiclistallsuntype ($row->id, $maptype, $pd);
if (Ereg ("<a", $mok)) {
$mapString = Str_replace ($lastLink, "<div style= ' margin-left:{$pd}px ' > $lastLink", $mapString);
$mapString. = $mok;
}
}
$mapString. = "</dl>\r\n";
return $mapString;
}
}
?>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.