muban大师 发表于 2020-6-17 13:04:31

织梦DEDECMS网站只搜索指定栏目文章的办法

方法1:
       
        织梦默认代码有这样一个代码,方便快捷解决这样的难题。只需要在模板搜索代码中加入 “”[i,“” 即可。如果只搜索单一的栏目,可以直接在form中添加即可,代码如下:
       
       
          [i,
          [i,
          [i,
          [i,
          
       
        方法2:
       
        首先我们找到/include/ 文件夹里面的arc.searchview.class.php,大约在300行和470行左右有个sql语句,在后面加上条件一个判断就可以了
       
        //搜索
        $query = "Select arc.*,act.typedir,act.typename,act.isdefault,act.defaultname,act.namerule,
        act.namerule2,act.ispart,act.moresite,act.siteurl]act.sitepath
        from `dede_archives` arc left join `dede_arctype` act on arc.typeid=act.id
        whereact.id not in (4,5,,6....) and {$this->AddSql} $ordersql limit $limitstart,$row";
        把sql语句换成这两句,括号里面的是你不搜索栏目的id 。或者将not in改为in,括号里面是你要搜索栏目的id
页: [1]
查看完整版本: 织梦DEDECMS网站只搜索指定栏目文章的办法