关于dedecms5.5/5.6 专题不能选取一级栏目的解决方法
打开\dede\inc\inc_catalog_options.php,将以下代码完全替换,即可。
烈火提示:
上面加粗的dede为后台目录,请注意自己的后台是否修改了。另外,使用以下代码前,请注意备份。
|
查看源码
打印代码帮助
|
|
01 |
Copy to ClipboardLiehuo.Net Codes引用的内容:[www.veryhuo.com] |
|
02 |
<?php |
|
03 |
|
|
04 |
function GetOptionList($selid=0,$userCatalog=0,$channeltype=0) |
|
05 |
{ |
|
06 |
global $OptionArrayList,$channels,$dsql; |
|
07 |
|
|
08 |
$dsql->SetQuery("Select id,typename From `dede_channeltype` "); |
|
09 |
$dsql->Execute(); |
|
10 |
$channels = Array(); |
|
11 |
while($row = $dsql->GetObject()) $channels[$row->id] = $row->typename; |
|
12 |
|
|
13 |
$OptionArrayList = ""; |
|
14 |
|
|
15 |
//当前选中的栏目 |
|
16 |
if($selid > 0) |
|
17 |
{ |
|
18 |
$row = $dsql->GetOne("Select id,typename,ispart,channeltype From `dede_arctype` where id='$selid'"); |
|
19 |
if($row['ispart']==1) $OptionArrayList .= "<option value='".$row['id']."'class='option1' selected='selected'>".$row['typename']."(封面频道)</option>\r\n"; |
|
20 |
else $OptionArrayList .= "<option value='".$row['id']."'selected='selected'>".$row['typename']."</option>\r\n"; |
|
21 |
} |
|
22 |
|
|
23 |
//是否限定用户管理的栏目 |
|
24 |
if($userCatalog>0) |
|
25 |
{ $query = "Select id,typename,ispart,channeltype From `dede_arctype` where ispart<>2 And id='$userCatalog' "; } |
|
26 |
else |
|
27 |
{ $query = "Select id,typename,ispart,channeltype From `dede_arctype` where ispart<>2 And reid=0 order by sortrank asc "; } |
|
28 |
|
|
29 |
$dsql->SetQuery($query); |
|
30 |
$dsql->Execute(); |
|
31 |
|
|
32 |
while($row=$dsql->GetObject()) |
|
33 |
{ |
|
34 |
if($row->ispart==1) $OptionArrayList .= "<option value='".$row->id."' class='option1'>".$row->typename."(封面频道)</option>\r\n"; |
|
35 |
else if($row->ispart==2) $OptionArrayList .=""; |
|
36 |
else if($row->channeltype!=$channeltype && $channeltype!=0) $OptionArrayList .= "<option value='".$row->id."' class='option2'>".$row->typename."(".$channels[$row->channeltype].")</option>\r\n"; |
|
37 |
else $OptionArrayList .= "<option value='".$row->id."' class='option3'>".$row->typename."</option>\r\n"; |
|
38 |
LogicGetOptionArray($row->id,"─",$channeltype,$dsql); |
|
39 |
} |
|
40 |
|
|
41 |
// liehuo.net |
|
42 |
return $OptionArrayList; |
|
43 |
} |
|
44 |
function LogicGetOptionArray($id,$step,$channeltype,&$dsql) |
|
45 |
{ |
|
46 |
global $OptionArrayList,$channels; |
|
47 |
$dsql->SetQuery("Select id,typename,ispart,channeltype From `dede_arctype` where reid='".$id."' And ispart<>2 order by sortrank asc"); |
|
48 |
$dsql->Execute($id); |
|
49 |
while($row=$dsql->GetObject($id)) |
|
50 |
{ |
|
51 |
if($row->ispart==1) $OptionArrayList .= "<option value='".$row->id."' class='option1'>$step".$row->typename."(封面频道)</option>\r\n"; |
|
52 |
else if($row->ispart==2) $OptionArrayList .=""; |
|
53 |
else if($row->channeltype!=$channeltype && $channeltype!=0) $OptionArrayList .=''; |
|
54 |
else $OptionArrayList .= "<option value='".$row->id."' class='option3'>$step".$row->typename."</option>\r\n"; |
|
55 |
LogicGetOptionArray($row->id,$step."─",$channeltype,$dsql); |
|
56 |
} |
|
57 |
} |
|
58 |
?> |