Go Back   vb.org Archive > vBulletin Modifications > vBulletin 4.x Modifications > vBulletin 4.x Template Modifications

Reply
 
Thread Tools
Replace search with Google Custom Search Details »»
Replace search with Google Custom Search
Version: 1.00, by Dave-ahfb Dave-ahfb is offline
Developer Last Online: Dec 2018 Show Printable Version Email this Page

Category: Integration with vBulletin - Version: 4.0.0 Beta 4 Rating:
Released: 11-30-2009 Last Update: Never Installs: 152
Template Edits
Re-useable Code  
No support by the author.

This mod assumes you have an adsense account and are using Google Custom Search.

You want to make sure your results page is named something other than the vb default search.php, this leaves the vb option open to those who click "advanced search"

Open your template navbar


find
PHP Code:
<form action="search.php?do=process" method="post" id="navbar_search"

replace with the form line of the google supplied code
example:
PHP Code:
<form action="http://www.ahfb2000.com/google.php" id="cse-search-box"


find
PHP Code:
<input type="hidden" name="s" value="{vb:raw session.sessionurl}" />
<
input type="hidden" name="securitytoken" value="{vb:raw bbuserinfo.securitytoken}" />
<
input type="hidden" name="do" value="process" /> 

replace with the first 3 hidden input types in your google code
example:
PHP Code:
    <input type="hidden" name="cx" value="partner-pub-xxxxxxxxxxxxxxxxxxxxxxx" />
    <
input type="hidden" name="cof" value="FORID:10" />
    <
input type="hidden" name="ie" value="ISO-8859-1" /> 


find
PHP Code:
<input type="text" value="" name="query" class="textbox" /> 

replace with
PHP Code:
<input type="text" value="" name="q" class="textbox" /> 


find
PHP Code:
<input type="image" class="searchbutton" src="{vb:stylevar imgdir_button}/search.png" name="submit" onclick="document.getElementById('navbar_search').submit;" /> 

replace with
PHP Code:
<input type="image" class="searchbutton" src="{vb:stylevar imgdir_button}/search.png" name="sa" onclick="document.getElementById('navbar_search').submit;" /> 


find
PHP Code:
</form

add this after
PHP Code:
<script type="text/javascript" src="http://www.google.com/cse/brand?form=cse-search-box&amp;lang=en"></script

Screenshots

File Type: jpg Image1.jpg (107.9 KB, 0 views)

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #82  
Old 06-03-2010, 02:37 AM
Brandon Sheley's Avatar
Brandon Sheley Brandon Sheley is offline
 
Join Date: Mar 2005
Location: Google Kansas
Posts: 4,678
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Is there another google search mod for the latest vB?
Reply With Quote
  #83  
Old 06-03-2010, 08:34 AM
Preech Preech is offline
 
Join Date: Aug 2002
Location: Fort Campbell
Posts: 325
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I've been using it. I have had no problem.
Reply With Quote
  #84  
Old 06-18-2010, 11:23 AM
Merih Merih is offline
 
Join Date: May 2010
Location: Turkey
Posts: 6
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

4.0.4 isnt becoming
Reply With Quote
  #85  
Old 06-20-2010, 11:57 PM
rockabilly rockabilly is offline
 
Join Date: Sep 2009
Posts: 13
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I am using 4.04 and I followed SemperFideles instructions very carefully.
When I do a site search, it displays a the search page and I can see the google adsense on the top and to the right, but it does not display any of the search results.

The page says:

" Your search - autos - did not match any documents.
Suggestions:
Make sure all words are spelled correctly.
Try different keywords.
Try more general keywords."

It seems that I am almost there, but I can't get any results to come up. Does anybody have any ideas? Thanks in advance!
Reply With Quote
  #86  
Old 06-21-2010, 12:48 AM
SemperFideles's Avatar
SemperFideles SemperFideles is offline
 
Join Date: Oct 2006
Location: Northern VA
Posts: 223
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Veer View Post
Please update for vb 4.0.3
Quote:
Originally Posted by Loco.M View Post
Is there another google search mod for the latest vB?

Search Mod is the same for 4.0.3 and 4.0.4. When you upgrade you have to replace the form code in the navbar template. The form code is really "version agnostic". The only thing that might change in the future is the format for creating a custom page but, for now, it's working fine.
Reply With Quote
  #87  
Old 06-21-2010, 03:35 PM
lubbie lubbie is offline
 
Join Date: May 2010
Posts: 169
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Just an idea, but i would like to have 2 checkboxes above or below the searchbox where u can select the search at google or in forum. Is that also possible?
Reply With Quote
  #88  
Old 06-21-2010, 04:51 PM
rockabilly rockabilly is offline
 
Join Date: Sep 2009
Posts: 13
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

As a follow up to my previous post, the google search mod works if I specify another URL of a totally different website of mine when I set up the google adsense code.
But when I revert back to my site's URL, it won't search my site.
My site is new and it is not yet indexed in google. Could this be the reason why google won't find search results for my site, because it is not indexed by google? I just submitted my sitemap to google in hopes that this mod will work when google indexes my site.

Thank you.....

Quote:
Originally Posted by SemperFideles View Post
Search Mod is the same for 4.0.3 and 4.0.4. When you upgrade you have to replace the form code in the navbar template. The form code is really "version agnostic". The only thing that might change in the future is the format for creating a custom page but, for now, it's working fine.
Reply With Quote
  #89  
Old 06-21-2010, 07:30 PM
SemperFideles's Avatar
SemperFideles SemperFideles is offline
 
Join Date: Oct 2006
Location: Northern VA
Posts: 223
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by rockabilly View Post
As a follow up to my previous post, the google search mod works if I specify another URL of a totally different website of mine when I set up the google adsense code.
But when I revert back to my site's URL, it won't search my site.
My site is new and it is not yet indexed in google. Could this be the reason why google won't find search results for my site, because it is not indexed by google? I just submitted my sitemap to google in hopes that this mod will work when google indexes my site.

Thank you.....
That makes sense. Search results are *only* what Google has indexed. This is a "drawback" on one level that it's not going to index private fora or pages that have not yet been indexed. The advantage is that it tends to give more relevant results as the built in search engine for vBulletin is relatively crude in comparison to the $Billions Google invests in search engine research.
Reply With Quote
  #90  
Old 06-21-2010, 07:34 PM
SemperFideles's Avatar
SemperFideles SemperFideles is offline
 
Join Date: Oct 2006
Location: Northern VA
Posts: 223
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by lubbie View Post
Just an idea, but i would like to have 2 checkboxes above or below the searchbox where u can select the search at google or in forum. Is that also possible?
Yes, it is possible. The mod to the navbar template falls between two form tags. You could add selection criteria to determine whether google.com or your site are searched when the user hits the search button. The problem you'll experience with this is trying to implement this in a way where it doesn't make your navbar get "fatter" unless you don't care about that. I don't have the time to tweak the form code to do this but you can find the form tags you could choose for your form by doing a search on Google and playing around with it.
Reply With Quote
  #91  
Old 08-01-2010, 06:57 AM
hany_c_v hany_c_v is offline
 
Join Date: Apr 2010
Posts: 7
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

very nice ,

i did it here

www.mngol.com
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 01:42 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.08006 seconds
  • Memory Usage 2,354KB
  • Queries Executed 26 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (10)bbcode_php
  • (5)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (4)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (1)pagenav_pagelinkrel
  • (11)post_thanks_box
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (1)postbit_attachment
  • (11)postbit_onlinestatus
  • (11)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_attachment
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete