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

softyun3年前cms教程55


建立的织梦dedecms 专题不能选取一级栏目,搜索了一些教程,然后测试了下,现在将我测试的教程发出来,供大家研究。
打开\dede\inc\inc_catalog_options.php,将以下代码完全替换,即可。
友情提示:上面红色的dede为后台目录,请注意自己的后台是否修改了。另外,使用以下代码前,请注意备份。

<?php 
function GetOptionList($selid=0,$userCatalog=0,$channeltype=0)  
{  
global $OptionArrayList,$channels,$dsql; 
$dsql->SetQuery("Select id,typename From `dede_channeltype` ");  
$dsql->Execute();  
$channels = Array();  
while($row = $dsql->GetObject()) $channels[$row->id] = $row->typename; 
$OptionArrayList = ""; 
//当前选中的栏目  
if($selid > 0)  
{  
$row = $dsql->GetOne("Select id,typename,ispart,channeltype From `dede_arctype` where id='$selid'");  
if($row['ispart']==1) $OptionArrayList .= "<option value='".$row['id']."' class='option1' selected='selected'>".$row['typename']."(封面频道)</option>\r\n";  
else $OptionArrayList .= "<option value='".$row['id']."' selected='selected'>".$row['typename']."</option>\r\n";  

//是否限定用户管理的栏目  
if($userCatalog>0)  
{ $query = "Select id,typename,ispart,channeltype From `dede_arctype` where ispart<>2 And id='$userCatalog' "; }  
else  
{ $query = "Select id,typename,ispart,channeltype From `dede_arctype` where ispart<>2 And reid=0 order by sortrank asc "; } 
$dsql->SetQuery($query);  
$dsql->Execute(); 
while($row=$dsql->GetObject())  
{  
if($row->ispart==1) $OptionArrayList .= "<option value='".$row->id."' class='option1'>".$row->typename."(封面频道)</option>\r\n";  
else if($row->ispart==2) $OptionArrayList .="";  
else if($row->channeltype!=$channeltype && $channeltype!=0) $OptionArrayList .= "<option value='".$row->id."' class='option2'>".$row->typename."(".$channels[$row->channeltype].")</option>\r\n";  
else $OptionArrayList .= "<option value='".$row->id."' class='option3'>".$row->typename."</option>\r\n";  
LogicGetOptionArray($row->id,"─",$channeltype,$dsql);  

//  
return $OptionArrayList;  
}  
function LogicGetOptionArray($id,$step,$channeltype,&$dsql)  
{  
global $OptionArrayList,$channels;  
$dsql->SetQuery("Select id,typename,ispart,channeltype From `dede_arctype` where reid='".$id."' And ispart<>2 order by sortrank asc");  
$dsql->Execute($id);  
while($row=$dsql->GetObject($id))  
{  
if($row->ispart==1) $OptionArrayList .= "<option value='".$row->id."' class='option1'>$step".$row->typename."(封面频道)</option>\r\n";  
else if($row->ispart==2) $OptionArrayList .="";  
else if($row->channeltype!=$channeltype && $channeltype!=0) $OptionArrayList .='';  
else $OptionArrayList .= "<option value='".$row->id."' class='option3'>$step".$row->typename."</option>\r\n";  
LogicGetOptionArray($row->id,$step."─",$channeltype,$dsql);  
}  
}  
?> 
以上内容仅供大家学习参考,有需要的可以记录下来。
 

免责声明:本文内容来自用户上传并发布,站点仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。请核实广告和内容真实性,谨慎使用。

相关文章

织梦dedecms软件内容页调用下载级别名称

给大家分享一下织梦dedecms软件内容页调用下载级别名称,仅供学习参考。我们在制作织梦软件下载站模板的时候经常会朋友调用软件级别名称的,那么如何在织梦dedecms软件内容页中调用下载级别名称具体方...

织梦DEDECMS 获取当前文档地址

我是在DEDECMS2007下做的,不知道这篇文章是否多余,DEDECMS调用很方便,但是我找了很久没有找到调用当前文档的方法,故做了以下教程:DEDECMS 获取当前文档地址。修改方法如下:修改in...

{dede:arclist}的学习心得,调用文章或者软件任何字段

基本语法:{dede:arclist typeid='' row='' col='' titlelen='' infolen='' imgwidth='' imgheight='' listtype=...

Dedecms实现键盘方向键翻页效果教程

织梦DEDECMS教程之实现按键盘方向键实现上一页/下一页翻页效果,这样可以提高用户体验,特别是在小说站和图片站中用的比较多。今天教大家一下DEDECMS教程之键盘翻页的制作方法:打开 include...

dedecms的首页、内容页、列表页中 动态JS调用评论数

dedecms的首页、内容页、列表页中 动态JS调用评论数本教程中评论数的调用方法  织梦Dedecms5.7能用,如果每次评论都更新HTML吧 又太费资源 。织梦Dedecms官方论坛看到很多朋友都...

dedecms 2007 默认幻灯片显示标题

var focus_width=280;var focus_height=220;var text_height=0;  给文字设置一个高度就可以了 一般设置为var text_height=20;...