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. if($userCatalog>0)  
      18. { $query = "Select id,typename,ispart,channeltype From `dede_arctype` where ispart<>2 And id='$userCatalog' "; }  
      19. else  
      20. { $query = "Select id,typename,ispart,channeltype From `dede_arctype` where ispart<>2 And reid=0 order by sortrank asc "; } 
      21. $dsql->SetQuery($query);  
      22. $dsql->Execute(); 
      23. while($row=$dsql->GetObject())  
      24. {  
      25. if($row->ispart==1) $OptionArrayList ."<option value='".$row->id."' class='option1'>".$row->typename."(封面頻道)</option>\r\n";  
      26. else if($row->ispart==2) $OptionArrayList .="";  
      27. else if($row->channeltype!=$channeltype && $channeltype!=0) $OptionArrayList ."<option value='".$row->id."' class='option2'>".$row->typename."(".$channels[$row->channeltype].")</option>\r\n";  
      28. else $OptionArrayList ."<option value='".$row->id."' class='option3'>".$row->typename."</option>\r\n";  
      29. LogicGetOptionArray($row->id,"─",$channeltype,$dsql);  
      30. //  
      31. return $OptionArrayList;  
      32. }  
      33. function LogicGetOptionArray($id,$step,$channeltype,&$dsql)  
      34. {  
      35. global $OptionArrayList,$channels;  
      36. $dsql->SetQuery("Select id,typename,ispart,channeltype From `dede_arctype` where reid='".$id."' And ispart<>2 order by sortrank asc");  
      37. $dsql->Execute($id);  
      38. while($row=$dsql->GetObject($id))  
      39. {  
      40. if($row->ispart==1) $OptionArrayList ."<option value='".$row->id."' class='option1'>$step".$row->typename."(封面頻道)</option>\r\n";  
      41. else if($row->ispart==2) $OptionArrayList .="";  
      42. else if($row->channeltype!=$channeltype && $channeltype!=0) $OptionArrayList .='';  
      43. else $OptionArrayList ."<option value='".$row->id."' class='option3'>$step".$row->typename."</option>\r\n";  
      44. LogicGetOptionArray($row->id,$step."─",$channeltype,$dsql);  
      45. }  
      46. }  
      47. ?> 
      以上內容僅供大家學習參考,有需要的可以記錄下來。

       

      查看更多 DedeCms教程  織夢模板  織夢DedeCms視頻教程  織夢dedecms專題

      來源:模板無憂//所屬分類:DedeCms教程/更新時間:2020-06-01
      相關DedeCms教程