织梦如何调用四级栏目

织梦如何调用四级栏目,第1张

概述织梦调用四级子栏目,首先需要修改文件:\include\taglib目录下的channel.lib.php,请将以下代码全部复制替换上述文件: ?php function lib_channel($ctag,$refObj) { global $_sys_globals,$envs,$dsql; $attlist = typeid|0,reid|0,row|100,col|1,type|son 织梦调用四级子栏目,首先需要修改文件:\include\taglib目录下的channel.lib.PHP,请将以下代码全部复制替换上述文件:   <?PHP function lib_channel(&$ctag,&$refObj) { global $_sys_globals,$envs,$dsql; $attList = "typeID|0,reID|0,row|100,col|1,type|son,currentstyle|"; FillAttsDefault($ctag->CAttribute->Items,$attList); extract($ctag->CAttribute->Items,EXTR_SKIP); $innertext = $ctag->GetInnerText(); $cacheID = trim($cacheID); if($cacheID !='') { $likeType = GetCacheBlock($cacheID); if($likeType != '') return $likeType; } $reID = 0; $topID = 0; if(empty($typeID) && $envs['typeID']!=0) $typeID = $envs['typeID']; $reID = $envs['reID']; }else{ $reID=0; if($type==''||$type=='sun') $type="son"; if($innertext=='') $innertext = GetSystemplets("channel_List.htm"); if($reID==0 && $typeID>0) $dbrow = $dsql->Getone("Select reID From dede_arctype where ID='$typeID' "); if(is_array($dbrow)) $reID = $dbrow['reID']; $likeType = ''; if($type=='top') $sql = "Select ID,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath,description From dede_arctype where reID=0 And ishIDden<>1 order by sortrank asc limit 0,$row"; else if($type=="son") //if($_sys_globals['typeID']>0) $typeID = $_sys_globals['typeID']; if($typeID==0) { return ''; From dede_arctype where reID='$typeID' And ishIDden<>1 order by sortrank asc limit 0,sans-serif; Font-size: 15px; line-height: 25px;"> else if($type=="self") if($reID==0) { From `dede_arctype` where reID='$reID' And ishIDden<>1 order by sortrank asc limit 0,sans-serif; Font-size: 15px; line-height: 25px;"> //And ID<>'$typeID' $needRel = false; $dtp2 = new DedeTagParse(); $dtp2->SetnameSpace("fIEld","[","]"); $dtp2->LoadSource($innertext); $dsql2 = clone $dsql; $dsql->Setquery($sql); $dsql->Execute(); $line = $row; //检查是否有子栏目,并返回rel提示(用于二级菜单) if(ereg(':rel',$innertext)) $needRel = true; if(empty($sql)) return ''; $totalRow = $dsql->GetTotalRow(); $GLOBALS['autoindex'] = 0; for($i=0;$i < $line;$i++) if($col>1) $likeType .= "<dl>\r\n"; for($j=0;$j<$col;$j++) if($col>1) $likeType .= "<dd>\r\n"; if($row=$dsql->GetArray()) $row['sonIDs'] = $row['rel'] = ''; if($needRel) $row['sonIDs'] = GetSonIDs($row['ID'],false); if($row['sonIDs']=='') $row['rel'] = ''; else $row['rel'] = " rel='dropmenu{$row['ID']}'"; //处理同级栏目中,当前栏目的样式 if( ($row['ID']==$typeID || ($topID==$row['ID'] && $type=='top') ) && $currentstyle!='' ) if($currentstyle!='') $linkOkstr = $currentstyle; $row['typelink'] = GetoneTypeUrlA($row); $linkOkstr = str_replace("~rel~",$row['rel'],$linkOkstr); $linkOkstr = str_replace("~ID~",$row['ID'],sans-serif; Font-size: 15px; line-height: 25px;"> $linkOkstr = str_replace("~typelink~",$row['typelink'],sans-serif; Font-size: 15px; line-height: 25px;"> $linkOkstr = str_replace("~typename~",$row['typename'],sans-serif; Font-size: 15px; line-height: 25px;"> $likeType .= $linkOkstr; }else $row['typelink'] = $row['typeurl'] = GetoneTypeUrlA($row); if(is_array($dtp2->CTags)) foreach($dtp2->CTags as $tagID=>$ctag){ if(isset($row[$ctag->Getname()])) $dtp2->Assign($tagID,$row[$ctag->Getname()]); elseif (preg_match('/^sonchannel[0-9]*$/',$ctag->Getname())) $likeType .= $dtp2->GetResult(); if($col>1) $likeType .= "</dd>\r\n"; $GLOBALS['autoindex']++; }//Loop Col if($col>1) $i += $col - 1; $likeType .= " </dl>\r\n"; }//Loop for $i reset($dsql2); $dsql->FreeResult(); return $likeType; function lib_channel_son($ctag,$typeID = 0,$dsql2) $attList = "row|100,sans-serif; Font-size: 15px; line-height: 25px;"> $dsql3 = clone $dsql2; $dsql2->Setquery($sql); $dsql2->Execute(); if($row=$dsql2->GetArray()) reset($dsql3); $dsql2->FreeResult(); ?>

  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> [fIEld:sonchannel2] <li><a href="[fIEld:typelink/]">===[fIEld:typename/]</a></li> [fIEld:sonchannel3] [/fIEld:sonchannel3] [/fIEld:sonchannel2] [/fIEld:sonchannel1] [/fIEld:sonchannel0] </ul> {/dede:channel}

上一篇:dedecms 二次开发调用当前作者文档的标签

下一篇:dedecms生成栏目列表页排序多样化pubdate,click等排序

总结

以上是内存溢出为你收集整理的织梦如何调用四级栏目全部内容,希望文章能够帮你解决织梦如何调用四级栏目所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/zz/1040644.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-24
下一篇2022-05-24

发表评论

登录后才能评论

评论列表(0条)

    保存