vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 4.x Template Modifications (https://vborg.vbsupport.ru/forumdisplay.php?f=246)
-   -   Integration with vBulletin - Replace search with Google Custom Search (https://vborg.vbsupport.ru/showthread.php?t=229247)

J6488EEA8E90 04-24-2010 01:33 AM

looks promising, will check it out

guvner 04-25-2010 08:57 PM

Well I finally got around the JS errors over at Google - no idea why I appeared to be the only one affected. :confused:

Anhow I now have it set up and I'd like to thank Dave-ahfb for the mod and also SemperFideles for making it a little easier to understand. :up:

For my set up I wanted my registered users to be able to use the VB search plus the advanced search but I wanted to restrict guests to the Google site search only - I figure every little bit helps when it comes to reducing server load. :cool:

For anyone who would like the same configuration, once you have your Google site search working properly, here's the template conditional I used in my navbar:

find:
Code:

                <form action="search.php?do=process" method="post" id="navbar_search" class="navbar_search">
                        <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" />
                        <span class="textboxcontainer"><span><input type="text" value="" name="query" class="textbox" tabindex="99"/></span></span>
                        <span class="buttoncontainer"><span><input type="image" class="searchbutton" src="{vb:stylevar imgdir_button}/search.png" name="submit" onclick="document.getElementById('navbar_search').submit;" tabindex="100"/></span></span>
                </form>
                <ul class="navbar_advanced_search">
                        <li><a href="search.php{vb:raw session.sessionurl_q}" accesskey="4">{vb:rawphrase advanced_search}</a></li>


replace it with:

Code:

<!-- Start Conditional Google Search Box -->
       
<vb:if condition="is_member_of($bbuserinfo, 1,3,4,22,49)">

<form action="http://www.YOUR/URL/TO/google.php" id="cse-search-box">
    <input type="hidden" name="cx" value="partner-pub-XXXXXXXXXXXXXXXX:XXXXXXXXXXX" />
    <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>
                <ul class="navbar_advanced_search">
                        <li><a href="search.php{vb:raw session.sessionurl_q}" accesskey="4">{vb:rawphrase advanced_search}</a></li>

<vb:else />

<form action="search.php?do=process" method="post" id="navbar_search" class="navbar_search">
                        <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" />
                        <span class="textboxcontainer"><span><input type="text" value="" name="query" class="textbox" tabindex="99"/></span></span>
                        <span class="buttoncontainer"><span><input type="image" class="searchbutton" src="{vb:stylevar imgdir_button}/search.png" name="submit" onclick="document.getElementById('navbar_search').submit;" tabindex="100"/></span></span>
</form>
                <ul class="navbar_advanced_search">
                        <li><a href="search.php{vb:raw session.sessionurl_q}" accesskey="4">{vb:rawphrase advanced_search}</a></li>


</vb:if>
                       
<!-- End Conditional Google Search Box -->


making sure you change the red text above to suit your system.

Finally go to your usergroup manager and disable search for the usergroups you have listed in the conditional above and you're done.

Mike :)

wampforum 05-01-2010 09:04 AM

this just wont work for me - I have tried this 6 times checking and re-checking everything but still get a blank page on results.
On the adsense page it gives me a search results code and informs me to paste onto google.php but you say not to do this and to copy google.php exactly as you have it - Im confused

baghdad4ever 05-01-2010 10:57 AM

it is work on 4.0.3

cloferba 05-05-2010 01:12 AM

first step of navbar editing is wrong

the first line it says user must find it is very different from the line on this post

=(

Winter Sonata 05-05-2010 09:45 AM

wampforum,

make sure to capitlaize the name of the temple like that ' GOOGLE'

Taurus MFF 05-10-2010 03:04 PM

works great, thanks Dave, installed on our test site for future deployment

and special thanks to SemperFi for the extended explanations! :up:

wampforum 05-12-2010 09:18 AM

ah done it - not sure what I did worng but its working now.
Does anyone happen to know if theres a way to move the text of the serach results into the centre more? I have a dark style that uses a whote box which results are displayed within but the text starts touching the border and I would like a little gap between the border and the text

cloferba 05-27-2010 12:43 AM

guys...you have tried this on 4.0.3?

Veer 05-29-2010 05:41 PM

Please update for vb 4.0.3


All times are GMT. The time now is 08:06 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01277 seconds
  • Memory Usage 1,750KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (1)pagenav_pagelinkrel
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete