演示页面:
http://www.jiaozhou.net/bbs/search.php输入关键词后,显示的搜索结果在站内,而不是跳到Google页面上。
[quote]
在您的网站上显示 AdSense for search 结果
现在,使用 AdSense for search 的发布商可以在自己的网站上打开搜索结果。通过向网页添加一组额外的搜索结果代码,您就可以在自己网站上以框架的形式显示 Google 搜索结果。这一新选项有助于您更有效地将 AdSense for search 融入网站。而且还有其他好处 - 您可以将用户留在自己的网站上,并为他们提供通过 Google 搜索获得的实用信息。[/quote]
首先,你需要是Google Adsense的用户。
如果不是,请点击这里申请
http://www.jiaozhou.net/blog/user1/1/archives/2006/6852.html (顺便打个广告,通过我申请的Adsense用户获得第一笔收入的时候我也有奖励,不过丝毫不影响你的收入,而且你可以获得我这个adsense资深专家的帮助,嘿嘿)
通过后台获得相关Google search的代码(这步Google有提示我就不详谈了)
安装方法:
1、上传GoogleSearch整个文件夹到根目录。包括googlesearch.php和lang文件
2、后台编辑风格-新建模板组“googlesearch”,添加子模板“googlesearch”
内容如下:
代码:
<DIV class=wttborder>
<!-- Google Search Result Snippet Begins -->
<div id="googleSearchUnitIframe"></div>
<script type="text/javascript">
var googleSearchIframeName = 'googleSearchUnitIframe';
var googleSearchFrameWidth = 800;
var googleSearchFrameHeight = 400;
var googleSearchFrameborder = 0;
</script>
<script type="text/javascript"
src='./../../&'quot;http://www.google.com/afsonline/show_afs_search.js">
</script>
<!-- Google Search Result Snippet Ends -->
</DIV>
3、建立模板关联组>>>>>> 用于关联组的名称:googlesearch 关联的模板:googlesearch 是否使用标准页面头尾:是
4、修改模板index_top,查找<if="$bbuserinfo['id']">,将下面到<else>为止的代码替换为
代码:
<!--这里将moly的默认搜索注释掉了,将来如果需要可以替换回来
<form action='./../../search.php' method='post'>
<input type='hidden' name='s' value='{sessionid}' />
<input type='hidden' name='do' value='search' />
<input type='text' size='30' name='keywords' onfocus="this.value=''" value='{$lang['quicksearch']}' class='bginput' />
<input type='submit' value='{$lang['_search']}' class='button' />
</form>-->
<!--搜索在此-->
<!-- Search Google -->
<form method="get" action='./../../&'quot;http://www.jiaozhou.net/bbs/googlesearch.php" target="_top">
<table bgcolor="#ffffff">
<tr><td nowrap="nowrap" valign="top" align="right" height="32">
<a href="http://www.google.com/">
<img src="http://www.google.com/logos/Logo_25wht.gif" border="0" alt="Google" align="middle"></img></a>
<input type="text" name="q" size="30" maxlength="255" value=""></input>
<input type="submit" name="sa" value="搜索" class='button'></input>
<input type="hidden" name="client" value="pub-0690995397080887"></input>
<!--这里的value记得修改为你自己的-->
<input type="hidden" name="forid" value="1"></input>
<input type="hidden" name="ie" value="GB2312"></input>
<input type="hidden" name="oe" value="GB2312"></input>
<input type="hidden" name="flav" value="0000"></input>
<input type="hidden" name="sig" value="R23yEH9-MPXsDvdZ"></input>
<input type="hidden" name="cof" value="GALT:#008000;GL:1;DIV:#336699;VLC:663399;AH:center;BGC:FFFFFF;LBGC:336699;ALC:0000FF;LC:0000FF;T:000000;GFNT:0000FF;GIMP:0000FF;FORID:11"></input>
<input type="hidden" name="hl" value="zh-CN"></input>
</td></tr></table>
</form>
<!-- Search Google -->
5、同理,search模板也可以如此修改
6、千万记得更新风格缓存
7、OK,试试搜索吧。如果有要做Google广告的可以点击我的博客地址
http://www.jiaozhou.net/blog/user1/1/archives/2006/6852.html,然后跟我联系,我可以给你一些优化建议。