导航
当前位置:网站首页 > 站长新闻 > CMS教程 > 织梦中{dede:channel}无法调用隐藏栏目解决方法

织梦中{dede:channel}无法调用隐藏栏目解决方法

作者:king 日期:2023-05-11 分类:CMS教程

dede如何控制隐藏栏目的显示与调用
许多时候有些栏目想在某些页面隐藏,在另外一些页面显示,怎么办?
貌似,织梦的channel标签不能获取隐藏的栏目,于是我自己动手修改channel标签
首先找到include/taglib/channel.lib.php
1.
$attlist = "typeid|0,reid|0,row|100,col|1,type|son,currentstyle|,cacheid|";
修改为:
$attlist = "typeid|0,reid|0,row|100,col|1,type|son,currentstyle|,cacheid|,showhide|no";
2.
在这两句下 
    $innertext = $ctag->GetInnerText();
    $line = empty($row) ? 100 : $row;
增加:

01 $showhideArr = array(
02  
03     'yes' => 0,
04  
05     'no' => 1,
06  
07     'both'=> -1,
08  
09 );
10  
11 $hideflag = $showhideArr[$showhide];

3.

01 if($type=='top')
02  
03   {
04  
05       $sql = "SELECT id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath
06  
07         From `dede_arctype` WHERE reid=0 And ishidden<>1 order by sortrank asc limit 0, $line ";
08  
09   }
10  
11   else if($type=='son')
12  
13   {
14  
15       if($typeid==0) return '';
16  
17       $sql = "SELECT id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath
18  
19         From `dede_arctype` WHERE reid='$typeid' And ishidden<>1 order by sortrank asc limit 0, $line ";
20  
21   }
22  
23   else if($type=='self')
24  
25   {
26  
27       if($reid==0) return '';
28  
29       $sql = "SELECT id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath
30  
31           FROM `dede_arctype` WHERE reid='$reid' And ishidden<>1 order by sortrank asc limit 0, $line ";
32  
33   }

修改为:

01 if($type=='top')
02  
03  {
04  
05      $sql = "SELECT id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath
06  
07        From `dede_arctype` WHERE reid=0 And ishidden<>$hideflag order by sortrank asc limit 0, $line ";
08  
09  }
10  
11  else if($type=='son')
12  
13  {
14  
15      if($typeid==0) return '';
16  
17      $sql = "SELECT id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath
18  
19        From `dede_arctype` WHERE reid='$typeid' And ishidden<>$hideflag order by sortrank asc limit 0, $line ";
20  
21  }
22  
23  else if($type=='self')
24  
25  {
26  
27      if($reid==0) return '';
28  
29      $sql = "SELECT id,typename,typedir,isdefault,ispart,defaultname

猜你还喜欢