Announcement

Collapse
No announcement yet.

Replace Search Engine with Google Search Engine :)

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • ersinjeofizik
    replied
    You should change the code between <form> </form>

    The two lines are:

    Your VB4's original Text BOX and Submit button.. You should replace your form (search engine form) code's text input part and submit part..
    Code:
    <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<vb:if condition="$stylevar['textdirection'] == 'rtl'">_rtl</vb:if>.<vb:if condition="(is_browser('ie') AND !is_browser('ie', 7) AND !is_browser('ie', 8))">gif<vb:else />png</vb:if>" name="submit" onclick="document.getElementById('cse-search-box').submit;" tabindex="100"/></span></span>

    Leave a comment:


  • SvetSatova
    replied
    Thanks man, excellent work!

    Do you know whether it's possible to do this without valid Adsense account? How would this code look like in that case?

    Thanks in advance!

    Leave a comment:


  • Replace Search Engine with Google Search Engine :)

    Hello friends,

    For a long time I wanted to change my Vbulletin 4.1.3's search engine with Google's search engine.
    I searched for forums, but I couldn't find a good solution. Yesterday, I made this change And my original search box theme is not changed. (search box on the Navigation bar.)

    If you want to look live example: http://www.ctrlpda.com

    To do this: Go to AdminCP > Styles & Templates > Style manager

    Choose "Edit template" right of the Style you want to modify. (I have 4 styles)

    Then:

    Double click to expand "Navigation / Breadcrump templates >>"

    Then under expanded "Navigation / Breadcrump templates <<"

    Double click "navbar"

    find:

    Code:
            <form action="search.php?{vb:raw session.sessionurl}do=process" method="post" id="navbar_search" class="navbar_search">
                <vb:comment><input type="hidden" name="s" value="{vb:raw session.sessionurl}" /></vb:comment>
                <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<vb:if condition="$stylevar['textdirection'] == 'rtl'">_rtl</vb:if>.<vb:if condition="(is_browser('ie') AND !is_browser('ie', 7) AND !is_browser('ie', 8))">gif<vb:else />png</vb:if>" name="submit" onclick="document.getElementById('navbar_search').submit;" tabindex="100"/></span></span>
            </form>
    And Replace this code with:
    Code:
    <form action="http://www.google.com.tr/cse" id="cse-search-box" target="_new" class="navbar_search">
      <div>
        <input type="hidden" name="cx" value="partner-pub-XXXXXXXXXXXXXXXXXXXXX" />
        <input type="hidden" name="ie" value="ISO-8859-9" />
    <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<vb:if condition="$stylevar['textdirection'] == 'rtl'">_rtl</vb:if>.<vb:if condition="(is_browser('ie') AND !is_browser('ie', 7) AND !is_browser('ie', 8))">gif<vb:else />png</vb:if>" name="submit" onclick="document.getElementById('cse-search-box').submit;" tabindex="100"/></span></span>
      </div>
    </form>
    And modify your:

    <input type="hidden" name="cx" value="partner-pub-XXXXXXXXXXXXXXXXXXXXX" />
    <input type="hidden" name="ie" value="ISO-8859-9" />


    according to your google adsense partner id and forum language code.

    And save template That's all..

    However if you want to remove "Advanced Search" link on your Navbar:

    You should remove the code:

    Code:
            <ul class="navbar_advanced_search">
                <li><a href="search.php{vb:raw session.sessionurl_q}" accesskey="4">{vb:rawphrase advanced_search}</a></li>
            </ul>
    from "navbar" template under </form> tag

    I think that another important thing is:

    target="_new" in the google search engine code:
    _new : means, open search page in a new tab, if browser doesn't support new tab (ex: ie6, old browsers), it is opened in a new window.

    if you want search page to be opened in a new window, you should change it to:

    target="_blank"

    This is my Google Search engine (right), and opened in new tab in Mozilla Firefox:



    I wanted to share this information.
    You can look live example to verify that it works..
    Last edited by ersinjeofizik; Tue 26 Apr '11, 12:24am.
widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
Working...
X