Go Back   vb.org Archive > vBulletin Modifications > vBulletin 4.x Modifications > vBulletin 4.x Template Modifications
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Use Google Custom Search In Navbar - Step By Step Details »»
Use Google Custom Search In Navbar - Step By Step
Version: 1.00, by rajubd rajubd is offline
Developer Last Online: Jan 2016 Show Printable Version Email this Page

Category: Mini Mods - Version: 4.x.x Rating:
Released: 05-10-2011 Last Update: Never Installs: 97
Template Edits
 
No support by the author.

This mod will replace vb search in navbar with google custom search.. you can still use advance search from navbar. google search provide much better result when you try to search word under 4 letters..

1. First download google.php upload in your forum root
2. Go to your AdminCP Go to Styles & Templates -> Style Manager
select Style then click Create New Template rename Template to GOOGLE
Paste this code in google Template :
Code:
{vb:stylevar htmldoctype}
<html xmlns="http://www.w3.org/1999/xhtml" dir="{vb:stylevar textdirection}" lang="{vb:stylevar languagecode}" id="vbulletin_html">
  <head>
    <title>{vb:raw vboptions.bbtitle}</title>
    {vb:raw headinclude}
  </head>
  <body>
    
    {vb:raw header}
    
    {vb:raw navbar}
    
    <div id="pagetitle">
      <h1>{vb:raw pagetitle}</h1>
    </div>
    
    <h2 class="blockhead">Google Custom Search</h2>
    <div class="blockbody">
      <div class="blockrow">

<div id="cse-search-results"></div>
<script type="text/javascript">
  var googleSearchIframeName = "cse-search-results";
  var googleSearchFormName = "cse-search-box";
  var googleSearchFrameWidth = 800;
  var googleSearchDomain = "www.google.com";
  var googleSearchPath = "/cse";
</script>
<script type="text/javascript" src="http://www.google.com/afsonline/show_afs_search.js"></script>
      </div>
    </div>
    
    {vb:raw footer}
  </body>
</html>
3. Then Open Navigation / Breadcrumb Templates Click Collapse button click navbar Template find <div id="globalsearch" class="globalsearch"> and <ul class="navbar_advanced_search"> remove all code between this with

Code:
<form action="http://www.mobilephonetalk.com/google.php" id="cse-search-box">
    <input type="hidden" name="cx" value="partner-pub-8038994048300561:7c8fy7cujxg" />
    <input type="hidden" name="cof" value="FORID:9" />
    <input type="hidden" name="ie" value="ISO-8859-1" />
            <span class="textboxcontainer"><span><input type="text" value="" name="q" class="textbox" /></span></span>
            <span class="buttoncontainer"><span><input type="image" class="searchbutton" src="{vb:stylevar imgdir_button}/search.png" name="sa" onclick="document.getElementById('navbar_search').submit;" />  </span></span>
        </form>
<script type="text/javascript" src="http://www.google.com/cse/brand?form=cse-search-box&amp;lang=en"></script>
Note : Replace http://www.mobilephonetalk.com with your won website name
Replace partner-pub-8038994048300561:7c8fy7cujxg with your won adsense code...

Download Now

File Type: php google.php (1.2 KB, 992 views)

Screenshots

File Type: jpg Capture.jpg (91.4 KB, 0 views)

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.
3 благодарности(ей) от:
appsfinder, daviet, KILLERMG

Comments
  #72  
Old 04-23-2012, 08:34 PM
ctrenks ctrenks is offline
 
Join Date: Aug 2007
Posts: 35
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I set this up, my header was all mangled but it did send results, the only issue I have otehr than cosmetic is that its also showing google adds on the right side. In my industry (casinos) I am not permitted to try and use adsense to make or promote casinos. I simply want the site search.

Is this possible?

Thanks,
Reply With Quote
  #73  
Old 04-28-2012, 06:49 AM
farazfaraz farazfaraz is offline
 
Join Date: Mar 2009
Location: Iran-Tehran
Posts: 59
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
3. Then Open Navigation / Breadcrumb Templates Click Collapse button click navbar Template find <div id="globalsearch" class="globalsearch"> and <ul class="navbar_advanced_search"> remove all code between this with
i can't find in my Templates!!

why???
Reply With Quote
  #74  
Old 05-10-2012, 06:21 PM
hqarrse hqarrse is offline
 
Join Date: Mar 2010
Posts: 48
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Good mod, working well in 4.1.12 although I can't see any reason why it wouldn't work in any of the versions mentioned as not working above.

I did change line 8 of google.php to a normal script name rather than 'test',so:

Code:
define('THIS_SCRIPT', 'google');
and this allows use of sensibly named template conditionals such as:

Code:
<vb:if condition="THIS_SCRIPT != 'google'">
The only other change needed, other than some layout tweaks, was to add the second header include to the template:

Code:
 {vb:raw headinclude_bottom}
Also working fine with Everywhere Sidebar using the instructions for adding the sidebar to custom pages.

Thanks for posting this - a real time saver in getting this working and well explained.
Reply With Quote
  #75  
Old 05-13-2012, 05:24 PM
Big-Pete Big-Pete is offline
 
Join Date: May 2009
Posts: 187
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Just upgraded a site from vB3 to vB4, and need a good search system, Used to use Marco's google search in vB3 but thats not working with vB4. Anyway, tried doing this but the required template must have been done away with as I can't find it. Where can I make the required edit?


Quote:
3. Then Open Navigation / Breadcrumb Templates Click Collapse button click navbar Template find <div id="globalsearch" class="globalsearch"> and <ul class="navbar_advanced_search"> remove all code between this with
Reply With Quote
  #76  
Old 05-18-2012, 11:16 AM
Mellow's Avatar
Mellow Mellow is offline
 
Join Date: Nov 2003
Posts: 142
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

No, it's there, just search your templates for globalsearch and it should show up.
Reply With Quote
  #77  
Old 05-27-2012, 05:05 PM
RoG Aftermath RoG Aftermath is offline
 
Join Date: Aug 2011
Posts: 51
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Mellow View Post
No, it's there, just search your templates for globalsearch and it should show up.
Nope its not there, i searched for it and all it did was bring up 2 templates both having to deal with google chrome, nothing to do with the Navbar, they definitely did away with it, there is a similiar code in the Navbar template that says search, but when i tried to replace that it does not allow it. 4.2.0
Reply With Quote
  #78  
Old 05-27-2012, 11:11 PM
trackpads's Avatar
trackpads trackpads is offline
 
Join Date: Aug 2003
Location: Armyville
Posts: 1,074
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Google changed the script location, this should fix it if you are getting the generic 'nothing I can do URL".

In Templates: Navbar after this
Code:
<div id="globalsearch" class="globalsearch">
Add the following (first replace the URL and Partner ID from adsense:
Code:
<form action="http://www.yourdomain.com/yourforumurl/google.php" id="cse-search-box">
    <input type="hidden" name="cx" value="partner-pub-xxxxxxxxxxxxxxxx:xxxxxxxxxx" />
    <input type="hidden" name="cof" value="FORID:9" />
    <input type="hidden" name="ie" value="ISO-8859-1" />
            <span class="textboxcontainer"><span><input type="text" value="" name="q" class="textbox" /></span></span>
            <span class="buttoncontainer"><span><input type="image" class="searchbutton" src="{vb:stylevar imgdir_button}/search.png" name="sa" onclick="document.getElementById('navbar_search').submit;" />  </span></span>
        </form>
<script type="text/javascript" src="http://www.google.com/coop/cse/brand?form=cse-search-box&amp;lang=en"></script>
If you dont see globalsearch it is because you have modified your Navbar template and need to revert it.
Reply With Quote
Благодарность от:
sweetpotato
  #79  
Old 05-29-2012, 11:20 PM
Jakobi Jakobi is offline
 
Join Date: Sep 2004
Posts: 16
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I had this installed and it works great, but it breaks the "New Posts" and the search. It shows the results but no posts.

https://www.vbulletin.com/forum/show...topped-Working
Reply With Quote
  #80  
Old 08-15-2012, 02:52 PM
dougdirac's Avatar
dougdirac dougdirac is offline
 
Join Date: Nov 2011
Posts: 208
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I installed this and it works, but the formatting isn't great.
Reply With Quote
  #81  
Old 08-17-2012, 03:03 PM
rajubd rajubd is offline
 
Join Date: Jun 2009
Posts: 209
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Still working on 4.2
For search advertising don't need to follow Google tos
Reply With Quote
Reply


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 06:12 PM.


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.05986 seconds
  • Memory Usage 2,350KB
  • Queries Executed 28 (?)
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
  • (7)bbcode_code
  • (3)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
  • (11)post_thanks_box
  • (4)post_thanks_box_bit
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (2)post_thanks_postbit
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (2)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_postinfo_query
  • fetch_postinfo
  • 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
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • 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