欢迎访问源码库!

源码库

您现在的位置是:源码库 > 模板下载 > DEDE模板 >

DEDE模板

DEDECMS模板dedeCMS调用四级栏目的办法

发布时间:2021-09-07DEDE模板评论
DEDE调用四级子栏目,第一需要修改文件:includetagli比特币现金annel.lib.php,请将以下代码全部复制替换上述文件:<?phpfunction lib_channel{global $_sys_globals,$envs,$dsql;$attlist = "typeid|0,reid

DEDE调用四级子栏目,第一需要修改文件:includetagli比特币现金annel.lib.php,请将以下代码全部复制替换上述文件:

<?phpfunction 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,descriptionFrom dede_arctype where reid=0 And ishidden<>1 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,descriptionFrom dede_arctype where reid='$typeid' And ishidden<>1 order by sortrank asc limit 0,$row";}else if{if {return '';}$sql = "Select id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath,descriptionFrom `dede_arctype` where reid='$reid' And ishidden<>1 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>rn";for{if $likeType .= "<dd>rn";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);}}}$likeType .= $dtp2->GetResult;}}if $likeType .= "</dd>rn";$GLOBALS['autoindex']++;}//Loop Colif{$i += $col - 1;$likeType .= " </dl>rn";}}//Loop for $ireset;$dsql->FreeResult;return $likeType;}function lib_channel_son{$attlist = "row|100,col|1,currentstyle|";FillAttsDefault;extract;$innertext = $ctag->GetInnerText;$dsql3 = clone $dsql2;$likeType = '';//if $typeid = $_sys_globals['typeid'];if {return '';}$sql = "Select id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath,descriptionFrom dede_arctype where reid='$typeid' And ishidden<>1 order by sortrank asc limit 0,$row";//And id<>'$typeid'$dtp2 = new DedeTagParse;$dtp2->SetNameSpace;$dtp2->LoadSource;$dsql2->SetQuery;$dsql2->Execute;$line = $row;for{if $likeType .= "<dl>rn";for{if $likeType .= "<dd>rn";if){$row['typelink'] = $row['typeurl'] = GetOneTypeUrlA;if){foreach{if])){$dtp2->Assign]);}elseif )){$dtp2->Assign);}}}$likeType .= $dtp2->GetResult;}if $likeType .= "</dd>rn";}//Loop Colif{$i += $col - 1;$likeType .= " </dl>rn";}}//Loop for $ireset;$dsql2->FreeResult;return $likeType;}?>


2、在模板中调用实例:
查询网站源码打印代码帮{dede:channel type='son' typeid='3'}[field:typename/]<ul>[field:sonchannel0]<li><a href="[field:typelink/]">[field:typename/]</a></li>[field:sonchannel1]<li><a href="[field:typelink/]">---[field:typename/]</a></li>

广告位