发布时间:2015-02-11 12:00:15作者:知识屋
Discuz是一款优秀的开源程序,最近有越来越多的朋友们用他来制作门户网站了,那么问题来了,就是怎么才能修改默认的搜索为门户搜索呢?下面电脑技术吧小编就给大家介绍一下Discuz修改默认搜索为门户搜索的方法教程!
首先找到文件:template/default/common/pubsearchform.htm
在里面找到这样一段话:
<!--{if $_G['fid'] && $_G['forum']['status'] != 3 && $mod != 'group'}--><!--{block slist[forumfid]}--><li><a href="javascript:;" rel="curforum" fid="$_G[fid]" >{lang search_this_forum}</a></li><!--{/block}--><!--{/if}--> <!--{if $_G['setting']['portalstatus'] && $_G['setting']['search']['portal']['status'] && ($_G['group']['allowsearch'] & 1 || $_G['adminid'] == 1)}--><!--{block slist[portal]}--><li><a href="javascript:;" rel="article">{lang article}</a></li><!--{/block}--><!--{/if}--> <!--{if $_G['setting']['search']['forum']['status'] && ($_G['group']['allowsearch'] & 2 || $_G['adminid'] == 1)}--><!--{block slist[forum]}--><li><a href="javascript:;" rel="forum" class="curtype">{lang thread}</a></li><!--{/block}--><!--{/if}--> <!--{if helper_access::check_module('blog') && $_G['setting']['search']['blog']['status'] && ($_G['group']['allowsearch'] & 4 || $_G['adminid'] == 1)}--><!--{block slist[blog]}--><li><a href="javascript:;" rel="blog">{lang blog}</a></li><!--{/block}--><!--{/if}--> <!--{if helper_access::check_module('album') && $_G['setting']['search']['album']['status'] && ($_G['group']['allowsearch'] & 8 || $_G['adminid'] == 1)}--><!--{block slist[album]}--><li><a href="javascript:;" rel="album">{lang album}</a></li><!--{/block}--><!--{/if}--> <!--{if $_G['setting']['groupstatus'] && $_G['setting']['search']['group']['status'] && ($_G['group']['allowsearch'] & 16 || $_G['adminid'] == 1)}--><!--{block slist[group]}--><li><a href="javascript:;" rel="group">$_G['setting']['navs'][3]['navname']</a></li><!--{/block}--><!--{/if}-->
这段即是对搜索分类的列表。
在里面看到这样一段:
<!--{if $_G['setting']['search']['forum']['status'] && ($_G['group']['allowsearch'] & 2 || $_G['adminid'] == 1)}--><!--{block slist[forum]}--><li><a href="javascript:;" rel="forum" class="curtype">{lang thread}</a></li><!--{/block}--><!--{/if}-->
从forum可以看出,是论坛,比较下与别处的不同。
在它的a标签里面,多了这样一个class定义:class="curtype"
好的,我们找到了不同,那么如果想修改默认的搜索,即把这个class放到要默认的类型a标签里面。
找到这样一句:
<!--{if $_G['setting']['portalstatus'] && $_G['setting']['search']['portal']['status'] && ($_G['group']['allowsearch'] & 1 || $_G['adminid'] == 1)}--><!--{block slist[portal]}--><li><a href="javascript:;" rel="article">{lang article}</a></li><!--{/block}--><!--{/if}-->
从portal可以看出,是对门户的搜索,那么我们就把那个class的定义转移到这个a标签里面,即把这句话修改成:
<!--{if $_G['setting']['portalstatus'] && $_G['setting']['search']['portal']['status'] && ($_G['group']['allowsearch'] & 1 || $_G['adminid'] == 1)}--><!--{block slist[portal]}--><li><a href="javascript:;" rel="article" class="curtype">{lang article}</a></li><!--{/block}--><!--{/if}-->
同时,把论坛的那个class定义去掉。然后刷新页面即可。
总结,就是把这样一段话:
<!--{if $_G['fid'] && $_G['forum']['status'] != 3 && $mod != 'group'}--><!--{block slist[forumfid]}--><li><a href="javascript:;" rel="curforum" fid="$_G[fid]" >{lang search_this_forum}</a></li><!--{/block}--><!--{/if}--> <!--{if $_G['setting']['portalstatus'] && $_G['setting']['search']['portal']['status'] && ($_G['group']['allowsearch'] & 1 || $_G['adminid'] == 1)}--><!--{block slist[portal]}--><li><a href="javascript:;" rel="article">{lang article}</a></li><!--{/block}--><!--{/if}--> <!--{if $_G['setting']['search']['forum']['status'] && ($_G['group']['allowsearch'] & 2 || $_G['adminid'] == 1)}--><!--{block slist[forum]}--><li><a href="javascript:;" rel="forum" class="curtype">{lang thread}</a></li><!--{/block}--><!--{/if}-->
修改成这样:
<!--{if $_G['fid'] && $_G['forum']['status'] != 3 && $mod != 'group'}--><!--{block slist[forumfid]}--><li><a href="javascript:;" rel="curforum" fid="$_G[fid]" >{lang search_this_forum}</a></li><!--{/block}--><!--{/if}--> <!--{if $_G['setting']['portalstatus'] && $_G['setting']['search']['portal']['status'] && ($_G['group']['allowsearch'] & 1 || $_G['adminid'] == 1)}--><!--{block slist[portal]}--><li><a href="javascript:;" rel="article" class="curtype">{lang article}</a></li><!--{/block}--><!--{/if}--> <!--{if $_G['setting']['search']['forum']['status'] && ($_G['group']['allowsearch'] & 2 || $_G['adminid'] == 1)}--><!--{block slist[forum]}--><li><a href="javascript:;" rel="forum">{lang thread}</a></li><!--{/block}--><!--{/if}-->
好了,以上就是电脑技术吧提供的Discuz修改默认搜索为门户搜索的方法教程! 大家应该已经按照教程修改成功了吧?
2014-11-19
怎么找回退出的QQ群的群号?
Winpcap是什么 Winpcap有什么用?
jsp文件怎么打开?
百度权重之我见~ 百度权重的等级划分
DEDE关于列表页分页和内容页分页与CSS不对应,错位的问题-DedeCM
怎样去掉dedecms【织梦】后台的安全提示?
帝国CMS 后台在线编辑CSS扩展修改教程!(建议收藏)
修改Dede友情链接dede:flink
nginx做下载服务器配置一例