Discuz!官方免费开源建站系统

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索

[发布] 增加google和baidu搜索功能(脱离qihoo和保留qihoo)for DZ5.0

[复制链接]
wjmwaq 发表于 2006-10-3 18:36:19 | 显示全部楼层 |阅读模式
说明,
本次修改实现在不同要求下实现一个小功能:
1、在原qihoo搜索的基础上增加google 和baidu的搜索功能。
2、在关闭qihoo功能情况下仍然可以使用google和baidu搜索功能
注:两项功能均需要改动search.php文件


演示地址:http://www.llgoo.com/bbs
修改程度:简单
修改文件:search.php   discuz.htm


search.php
查找
  1. $cachelife_text = 3600;                // Life span for cache of text searching
复制代码

在下面增加

  1.   if($stype == 'google')
  2.                 {
  3.                         $url = 'http://www.google.com/search?hl=zh-CN&q='.rawurlencode($srchtxt).'&btnG=Google+%E6%90%9C%E7%B4%A2&lr=';
  4.                         header("Location: $url");
  5.                         dexit();
  6.                         }
  7.         else if($stype == 'baidu')
  8.                 {
  9.                         $url = 'http://www.baidu.com/s?wd='.rawurlencode($srchtxt).'&cl=3';
  10.                         header("Location: $url");
  11.                         dexit();
  12.                         }
复制代码

templates/default/discuz.htm
1、在原qihoo搜索的基础上增加google 和baidu的搜索功能。查找
  1. <option value="" selected>{lang qihoo_search_filltext}</option>
复制代码

替换成
  1. <option value="google" selected><!-- {lang google_search_filltext} -->google搜索</option><option value="baidu"><!-- {lang baidu_search_filltext} -->baidu搜索</option><option value="">{lang qihoo_search_filltext}</option>
复制代码

演示:

2、在关闭qihoo功能情况下仍然可以使用google和baidu搜索功能
查找
  1. <!--{/if}-->

  2. <!--{if !empty($newpmexists)}-->
  3.         <div style="clear: both; margin-top: 5px">
复制代码

大概在85行,不要找错了。
在上面添加
  1.         <!--显示google和baidu搜索开始-->
  2.                 <div class="subtable" style="clear: both; width: {TABLEWIDTH}">
  3.                 <div class="right">
  4.                 <form method="post" action="search.php?srchtype=qihoo" onSubmit="this.target='_blank';">
  5.                 <input type="hidden" name="searchsubmit" value="yes">
  6.                 <input type="text" name="srchtxt" value="$qihoo_searchboxtxt" size="30" class="input" style="{BGCODE};" onmouseover="this.focus();this.value='';this.onmouseover=null;">
  7.                 <select name="stype"><option value="google" selected>google搜索</option><option value="baidu">baidu搜索</option></select>
  8.                 <input name="searchsubmit" class="button" type="submit" value="{lang search}">
  9.                 </form>
  10.                 </div>
  11.         </div>
  12.         <!--显示google和baidu搜索END-->
复制代码


修改完成
演示:

如果需要后台控制功能,需改动后台代码,不知道有没有需求,暂时没有做。

[ 本帖最后由 wjmwaq 于 2006-10-4 14:00 编辑 ]
 楼主| wjmwaq 发表于 2006-10-3 18:50:53 | 显示全部楼层
演示图片,如下
回复

使用道具 举报

maget 发表于 2006-10-3 18:54:45 | 显示全部楼层
我想在后台不开奇虎的情况下使用这个。。

如果是的话,希望楼主发布。

好烦奇虎
回复

使用道具 举报

aicainiao 发表于 2006-10-3 18:57:23 | 显示全部楼层
支持!希望放出来
回复

使用道具 举报

 楼主| wjmwaq 发表于 2006-10-3 21:15:28 | 显示全部楼层
要得人不多哦
回复

使用道具 举报

梦中朦胧 发表于 2006-10-3 21:17:51 | 显示全部楼层
大家都属于潜水状态~
回复

使用道具 举报

zyfdyx 发表于 2006-10-3 21:18:47 | 显示全部楼层
操!你不弄出来#谁来支持啊!真不明白你们这些人在干什么!???????????????????
回复

使用道具 举报

大麻哈鱼 发表于 2006-10-3 23:46:14 | 显示全部楼层
要是不开qihoo就可以用这个就好了
嘿嘿
回复

使用道具 举报

HY清风 发表于 2006-10-4 00:24:32 | 显示全部楼层
功能不错啊!
支持!
回复

使用道具 举报

bvtc 发表于 2006-10-4 00:25:57 | 显示全部楼层
老是说这个!!!开发出来再说吧!!
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|Discuz! 官方站 ( 皖ICP备16010102号 )star

GMT+8, 2024-9-29 11:24 , Processed in 0.166695 second(s), 17 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

快速回复 返回顶部 返回列表