Add Google Custom Search to Navbar Drop-Down Menu
This is not supported. I am not a coder. This is just something that took me a long time to figure out, and I'm hoping it will come in handy for someone else.
Warning/disclaimer: I am not responsible if this breaks your site or makes it insecure. I will not help you fix your site if you harm it while doing this mod. Make sure to have a backup of any template you modify. My goal was to encourage people to use Google search to search my site for 3 reasons, from most to least important:
At the same time, I wanted registered members to have the option to use the "Advanced Search" built into vBulletin, because this really comes in handy when you want to find a specific post by a specific member, in a specific forum, etc. The result of this mod is that when unregistered guests click on "Search" in the Navbar, they get a Google Custom Search box only. When members click on "Search", they get the Google Custom Search box as well as a link to use the regular Advanced Search (see screenshot). It's a very easy mod to do: 1) Go to Google.com/Adsense and create a custom search engine. After you do this, you will be presented with some code, the relevant portion of which will look like this: Code:
value="partner-pub-XXXXXXXXXXXXXXXX:XXXXXXXXXX" 2) Go to your Navbar template and make a backup of it (copy the whole thing to a text file and save it in case you mess something up). 3) In your Navbar template, replace everything between Code:
<!-- header quick search form --> Code:
<!-- / header quick search form --> Code:
<div class="vbmenu_popup" id="navbar_search_menu" style="display:none;margin-top:3px" align="$stylevar[left]"> <table cellpadding="4" cellspacing="1" border="0"> <tr> <td class="alt2"> <DIV ALIGN=RIGHT> <form action="http://www.google.com/cse" id="cse-search-box" target="_blank"> <div> <input type="hidden" name="cx" value="partner-pub-XXXXXXXXXXXXXXXX:XXXXXXXXXX" /> <input type="hidden" name="ie" value="UTF-8" /> <input type="text" name="q" size="40" /> <input type="submit" name="sa" value="Search" /> </div> </form> <script type="text/javascript" src="http://www.google.com/coop/cse/brand?form=cse-search-box&lang=en"></script></DIV></td> </tr> <if condition="!is_member_of($bbuserinfo, 1, 3)"> <tr> <td class="alt2"> <DIV ALIGN=CENTER> <font size="1">Google Custom Search (above) is the recommended </br>method for searching Mu-43.com in most cases.</br></br><a href="search.php$session[sessionurl_q]" accesskey="4" rel="nofollow">Click here to use the forum search instead</a> (useful for </br>limiting your search to specific member or subforum).</font> </DIV></td></tr></if> </table> </div> Make sure to make the following substitutions in the code above:
That's it. See the attachment for how this will look to your members (guests only see the Google search). Feel free to try it out on http://www.mu-43.com to see how it works. Download No files for download. Screenshots |
Similar Mods
Boolean Search in Search Drop-Down Menu Option in Navbar | vBulletin 3.5 Template Modifications |