1. 当前位置:首页 > 织梦建站教程 > 二次开发 > 织梦dede调用四级栏目

织梦dede调用四级栏目

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

  1. <?php
  2. function lib_channel(&$ctag,&$refObj)
  3. {
  4. global $_sys_globals,$envs,$dsql;
  5. $attlist = "typeid|0,reid|0,row|100,col|1,type|son,currentstyle|";
  6. FillAttsDefault($ctag->CAttribute->Items,$attlist);
  7. extract($ctag->CAttribute->Items, EXTR_SKIP);
  8. $innertext = $ctag->GetInnerText();
  9. $cacheid = trim($cacheid);
  10. if($cacheid !='') {
  11. $likeType = GetCacheBlock($cacheid);
  12. if($likeType != '') return $likeType;
  13. }
  14.  
  15. $reid = 0;
  16. $topid = 0;
  17. if(empty($typeid) && $envs['typeid']!=0)
  18. {
  19. $typeid = $envs['typeid'];
  20. $reid = $envs['reid'];
  21. }else{
  22. $reid=0;
  23. }
  24. if($type==''||$type=='sun') $type="son";
  25. if($innertext=='') $innertext = GetSysTemplets("channel_list.htm");
  26. if($reid==0 && $typeid>0)
  27. {
  28. $dbrow = $dsql->GetOne("Select reid From dede_arctype where id='$typeid' ");
  29. if(is_array($dbrow)) $reid = $dbrow['reid'];
  30. }
  31. $likeType = '';
  32. if($type=='top')
  33. {
  34. $sql = "Select id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath,description
  35. From dede_arctype where reid=0 And ishidden<>1 order by sortrank asc limit 0,$row";
  36. }
  37. else if($type=="son")
  38. {
  39. //if($_sys_globals['typeid']>0) $typeid = $_sys_globals['typeid'];
  40. if($typeid==0) {
  41. return '';
  42. }
  43. $sql = "Select id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath,description
  44. From dede_arctype where reid='$typeid' And ishidden<>1 order by sortrank asc limit 0,$row";
  45. }
  46. else if($type=="self")
  47. {
  48. if($reid==0) {
  49. return '';
  50. }
  51. $sql = "Select id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath,description
  52. From `dede_arctype` where reid='$reid' And ishidden<>1 order by sortrank asc limit 0,$row";
  53. }
  54. //And id<>'$typeid'
  55. $needRel = false;
  56. $dtp2 = new DedeTagParse();
  57. $dtp2->SetNameSpace("field","[","]");
  58. $dtp2->LoadSource($innertext);
  59. $dsql2 = clone $dsql;
  60. $dsql->SetQuery($sql);
  61. $dsql->Execute();
  62. $line = $row;
  63. //检查是否有子栏目,并返回rel提示(用于二级菜单)

    标签:

    本文地址:织梦dede调用四级栏目 https://www.shenqiu123.com/a/jianzhan/ercikaifa/4587.html

 

QR code

联系我们

010-80805180

 

QR code