DEDECMS专题不能选取一级栏目的解决方案_DedeCms教程

编辑Tag赚U币
教程Tag:暂无Tag,欢迎添加,赚取U币!
建立的织梦dedecms 专题不能选取一级栏目,搜索了一些教程,然后测试了下,现在将我测试的教程发出来,供大家研究。
打开\dede\inc\inc_catalog_options.php,将以下代码完全替换,即可。
友情提示:上面红色的dede为后台目录,请注意自己的后台是否修改了。另外,使用以下代码前,请注意备份。
  1. <?php 
  2. function GetOptionList($selid=0,$userCatalog=0,$channeltype=0)  
  3. {  
  4. global $OptionArrayList,$channels,$dsql; 
  5. $dsql->SetQuery("Select id,typename From `dede_channeltype` ");  
  6. $dsql->Execute();  
  7. $channels = Array();  
  8. while($row = $dsql->GetObject()) $channels[$row->id] = $row->typename; 
  9. $OptionArrayList = ""; 
  10. //当前选中的栏目  
  11. if($selid > 0)  
  12. {  
  13. $row = $dsql->GetOne("Select id,typename,ispart,channeltype From `dede_arctype` where id='$selid'");  
  14. if($row['ispart']==1) $OptionArrayList .= "<option value='".$row['id']."' class='option1' selected='selected'>".$row['typename']."(封面频道)</option>\r\n";  
  15. else $OptionArrayList .= "<option value='".$row['id']."' selected='selected'>".$row['typename']."</option>\r\n";  
  16. } 
  17. //是否限定用户管理的栏目  
  18. if($userCatalog>0)  
  19. { $query = "Select id,typename,ispart,channeltype From `dede_arctype` where ispart<>2 And id='$userCatalog' "; }  
  20. else  
  21. { $query = "Select id,typename,ispart,channeltype From `dede_arctype` where ispart<>2 And reid=0 order by sortrank asc "; } 
  22. $dsql->SetQuery($query);  
  23. $dsql->Execute(); 
  24. while($row=$dsql->GetObject())  
  25. {  
  26. if($row->ispart==1) $OptionArrayList .= "<option value='".$row->id."' class='option1'>".$row->typename."(封面频道)</option>\r\n";  
  27. else if($row->ispart==2) $OptionArrayList .="";  
  28. else if($row->channeltype!=$channeltype && $channeltype!=0) $OptionArrayList .= "<option value='".$row->id."' class='option2'>".$row->typename."(".$channels[$row->channeltype].")</option>\r\n";  
  29. else $OptionArrayList .= "<option value='".$row->id."' class='option3'>".$row->typename."</option>\r\n";  
  30. LogicGetOptionArray($row->id,"─",$channeltype,$dsql);  
  31. } 
  32. //  
  33. return $OptionArrayList;  
  34. }  
  35. function LogicGetOptionArray($id,$step,$channeltype,&$dsql)  
  36. {  
  37. global $OptionArrayList,$channels;  
  38. $dsql->SetQuery("Select id,typename,ispart,channeltype From `dede_arctype` where reid='".$id."' And ispart<>2 order by sortrank asc");  
  39. $dsql->Execute($id);  
  40. while($row=$dsql->GetObject($id))  
  41. {  
  42. if($row->ispart==1) $OptionArrayList .= "<option value='".$row->id."' class='option1'>$step".$row->typename."(封面频道)</option>\r\n";  
  43. else if($row->ispart==2) $OptionArrayList .="";  
  44. else if($row->channeltype!=$channeltype && $channeltype!=0) $OptionArrayList .='';  
  45. else $OptionArrayList .= "<option value='".$row->id."' class='option3'>$step".$row->typename."</option>\r\n";  
  46. LogicGetOptionArray($row->id,$step."─",$channeltype,$dsql);  
  47. }  
  48. }  
  49. ?> 
以上内容仅供大家学习参考,有需要的可以记录下来。

 

查看更多 DedeCms教程  织梦模板  织梦DedeCms视频教程  织梦dedecms专题

来源:模板无忧//所属分类:DedeCms教程/更新时间:2020-06-01
相关DedeCms教程: