织梦dedecms如何调用四级栏目

2021-06-23 作者:未知   |   浏览(

织梦CMS调用四级子栏目,第一需要修改文件:\include\taglib目录下的channel.lib.php,请将以下代码全部复制替换上述文件:

?php

function lib_channel

{

global $_sys_globals,$envs,$dsql;

$attlist = typeid|0,reid|0,row|100,col|1,type|son,currentstyle|;

FillAttsDefault;

extract;

$innertext = $ctag-GetInnerText;

$cacheid = trim;

if {

$likeType = GetCacheBlock;

if return $likeType;

}

$reid = 0;

$TOPid = 0;

if $envs[typeid]!=0)

{

$typeid = $envs[typeid];

$reid = $envs[reid];

}else{

$reid=0;

}

if $type=son;

if $innertext = GetSysTemplets;

if

{

$dbrow = $dsql-GetOne;

if) $reid = $dbrow[reid];

}

$likeType = ;

if

{

$sql = Select id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath,description

From dede_arctype where reid=0 And ishidden1 order by sortrank asc limit 0,$row;

}

else if

{

//if $typeid = $_sys_globals[typeid];

if {

return ;

}

$sql = Select id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath,description

From dede_arctype where reid=$typeid And ishidden1 order by sortrank asc limit 0,$row;

}

else if

{

if {

return ;

}

$sql = Select id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath,description

From `dede_arctype` where reid=$reid And ishidden1 order by sortrank asc limit 0,$row;

}

//And id$typeid

$needRel = false;

$dtp2 = new DedeTagParse;

$dtp2-SetNameSpace;

$dtp2-LoadSource;

$dsql2 = clone $dsql;

$dsql-SetQuery;

$dsql-Execute;

$line = $row;

//检查是不是有子栏目,并返回rel提示(用于二级菜单)

if) $needRel = true;

if) return ;

$dsql-SetQuery;

$dsql-Execute;

$totalRow = $dsql-GetTotalRow;

$GLOBALS[autoindex] = 0;

for

{

if $likeType .= dl\r\n;

for

{

if $likeType .= dd\r\n;

if)

{

$row[sonids] = $row[rel] = ;

if

{

$row[sonids] = GetSonIds;

if $row[rel] = ;

else $row[rel] = rel=dropmenu{$row[id]};

}

//处置同级栏目中,目前栏目的样式

if ) $currentstyle!= )

{

if

{

$linkOkstr = $currentstyle;

$row[typelink] = GetOneTypeUrlA;

$linkOkstr = str_replace;

$linkOkstr = str_replace;

$linkOkstr = str_replace;

$linkOkstr = str_replace;

$likeType .= $linkOkstr;

}

}else

{

$row[typelink] = $row[typeurl] = GetOneTypeUrlA;

if)

{

foreach{

if]))

{

$dtp2-Assign]);

}

elseif ))

{

$dtp2-Assign);

}

$reid = 0;

$TOPid = 0;

if $envs[typeid]!=0)

{

$typeid = $envs[typeid];

$reid = $envs[reid];

}else{

$reid=0;

}

if $type=son;

if $innertext = GetSysTemplets;

if

{

$dbrow = $dsql-GetOne;

if) $reid = $dbrow[reid];

}

$likeType = ;

if

{

$sql = Select id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath,description

From dede_arctype where reid=0 And ishidden1 order by sortrank asc limit 0,$row;

}

else if

{

//if $typeid = $_sys_globals[typeid];

if {

return ;

}

$sql = Select id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath,description

From dede_arctype where reid=$typeid And ishidden1 order by sortrank asc limit 0,$row;

}

else if

{

if {

return ;

}

$sql = Select id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath,description

From `dede_arctype` where reid=$reid And ishidden1 order by sortrank asc limit 0,$row;

}

//And id$typeid

$needRel = false;

$dtp2 = new DedeTagParse;

$dtp2-SetNameSpace;

$dtp2-LoadSource;

$dsql2 = clone $dsql;

$dsql-SetQuery;

$dsql-Execute;

$line = $row;

//检查是不是有子栏目,并返回rel提示(用于二级菜单)

if) $needRel = true;

if) return ;

$dsql-SetQuery;

$dsql-Execute;

$totalRow = $dsql-GetTotalRow;

$GLOBALS[autoindex] = 0;

for

{

if $likeType .= dl\r\n;

for

{

if $likeType .= dd\r\n;

if)

{

$row[sonids] = $row[rel] = ;

if

{

$row[sonids] = GetSonIds;

if $row[rel] = ;

else $row[rel] = rel=dropmenu{$row[id]};

}

//处置同级栏目中,目前栏目的样式

if ) $currentstyle!= )

{

if

{

$linkOkstr = $currentstyle;

$row[typelink] = GetOneTypeUrlA;

$linkOkstr = str_replace;

$linkOkstr = str_replace;

$linkOkstr = str_replace;

$linkOkstr = str_replace;

$likeType .= $linkOkstr;

}

}else

{

$row[typelink] = $row[typeurl] = GetOneTypeUrlA;

if)

{

foreach{

if]))

{

$dtp2-Assign]);

}

elseif ))

{

$dtp2-Assign);

}