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)
-   -   Mini Mods - Use Google Custom Search In Navbar - Step By Step (https://vborg.vbsupport.ru/showthread.php?t=263440)

rajubd 05-10-2011 10:00 PM

Use Google Custom Search In Navbar - Step By Step
 
1 Attachment(s)
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...

RobbieZ 05-11-2011 10:52 AM

Nice work.

Doesnt work on a closed forum where you have to log in to view the site as google cant access this!

rajubd 05-13-2011 01:15 AM

Quote:

Originally Posted by RobbieZ (Post 2194366)
Nice work.

Doesnt work on a closed forum where you have to log in to view the site as google cant access this!

Yes but you can use advanced or forum search..

obmob 06-03-2011 03:40 PM

Works really nice, the template makes it even better. :)

rajubd 06-06-2011 08:28 PM

Quote:

Originally Posted by obmob (Post 2203105)
Works really nice, the template makes it even better. :)

Thanks...

Vaira 06-09-2011 04:59 PM

I got global search results, but not for the website specific only.

Did I miss something?
I have removed the partner-pub-xxxxxxx:xxxxxx-xxxxxx line completely since I don't have a ad sense account

Thanks.

Vaira 06-10-2011 11:10 AM

OK I did some research....
This method is made to work with adsense only and is spread all over the net.

You simply cannot remove the line.

For non adsense users just go for that:
https://vborg.vbsupport.ru/showthrea...=241563&page=3

Ichigo88 06-11-2011 06:34 PM

4.1.3 not work -.-

rajubd 06-11-2011 06:52 PM

I am using it in my site with 4.1.3 ... try again

rajubd 06-11-2011 06:54 PM

Quote:

Originally Posted by Vaira (Post 2205796)
OK I did some research....
This method is made to work with adsense only and is spread all over the net.

You simply cannot remove the line.

For non adsense users just go for that:
https://vborg.vbsupport.ru/showthrea...=241563&page=3

I didn't test it for non AdSense users thanks for info...

temsamane 06-12-2011 09:28 PM

i tried the script, but it doesnt give me search results.

look at: http://www.rkempo.nl/forums/forum.php

help me with this issue please

rajubd 06-12-2011 09:41 PM

describe what you did?

Vaira 06-12-2011 11:57 PM

Quote:

Originally Posted by rajubd (Post 2206354)
I didn't test it for non AdSense users thanks for info...

You're welcome.
We are thinking about of getting an adsense account, and if not the other solution is right.
Thanks for your mod. :);)

BlueCheri 06-13-2011 09:28 AM

Hi very nice, installed.

Getting following error;

400. That’s an error.
Your client has issued a malformed or illegal request. That’s all we know.


Using 4.1.2 version, Can you help me on this?

Thanx in advance.

temsamane 06-13-2011 05:33 PM

this is my navbar code. where do i have to place the second code? i dont see globalsearch

Code:

<div id="navbar" class="navbar">
<div class="navbarLeft"><div class="navbarRight">
        <ul id="navtabs" class="navtabs floatcontainer<vb:if condition="$show['member'] AND $notifications_total"> notify</vb:if>">
                {vb:raw template_hook.navtab_start}
                <vb:if condition="!$vboptions['selectednavtab'] AND THIS_SCRIPT != 'search'">
                        <li class="selected"><a class="navtab" href="{vb:link forumhome}">{vb:rawphrase forum}</a>
                                <ul class="floatcontainer">
                                        {vb:raw template_hook.navbar_start}
                                        <vb:if condition="$show['searchbuttons']">
                                                <vb:if condition="$show['member']">
                                                <li><a href="search.php?{vb:raw session.sessionurl}do=getnew&amp;contenttype=vBForum_Post">{vb:rawphrase new_posts_nav}</a></li>
                                                <vb:else />
                                                <li><a href="search.php?{vb:raw session.sessionurl}do=getdaily&amp;contenttype=vBForum_Post">{vb:rawphrase todays_posts}</a></li>
                                                </vb:if>
                                        </vb:if>
                                        {vb:raw template_hook.navbar_after_getnew}
                                        <vb:if condition="$show['pmmainlink']">
                                                <li><a href="private.php{vb:raw session.sessionurl_q}" rel="nofollow">{vb:rawphrase private_messages}</a></li>
                                        </vb:if>
                                        {vb:raw template_hook.navbar_after_pm}
                                        <vb:if condition="$show['communitylink']">
                                        <li class="popupmenu">
                                                <a href="javascript://" class="popupctrl" accesskey="6">{vb:rawphrase community}</a>
                                                <ul class="popupbody popuphover">
                                                        {vb:raw template_hook.navbar_community_menu_start}
                                                        <vb:if condition="$show['quick_links_groups']">
                                                                <li><a href="{vb:link grouphome}">{vb:rawphrase social_groups}</a></li>
                                                        </vb:if>
                                                        <vb:if condition="$show['quick_links_albums']">
                                                                <li><a href="album.php{vb:raw session.sessionurl_q}">{vb:rawphrase pictures_and_albums}</a></li>
                                                        </vb:if>
                                                        <vb:if condition="$bbuserinfo['userid']">
                                                                <li><a href="profile.php?{vb:raw session.sessionurl}do=buddylist"><vb:if condition="$show['friends_and_contacts']">{vb:rawphrase contacts_and_friends}<vb:else />{vb:rawphrase contacts}</vb:if></a></li>
                                                        </vb:if>
                                                        <vb:if condition="$show['memberslist']">
                                                                <li><a href="memberlist.php{vb:raw session.sessionurl_q}">{vb:rawphrase members_list}</a></li>
                                                        </vb:if>
                                                        {vb:raw template_hook.navbar_community_menu_end}
                                                </ul>
                                        </li>
                                        </vb:if>
                                        {vb:raw template_hook.navbar_after_community}
                                        <li class="popupmenu">
                                                <a href="javascript://" class="popupctrl">{vb:rawphrase forum_actions}</a>
                                                <ul class="popupbody popuphover">
                                                        <li>
                                                                <a href="{vb:raw $vboptions.vbforum_url}{vb:if "$vboptions['vbforum_url']", '/', ''}forumdisplay.php?{vb:raw session.sessionurl}do=markread&amp;markreadhash={vb:raw bbuserinfo.securitytoken}">{vb:rawphrase mark_forums_read}</a>
                                                        </li>
                                                        <vb:if condition="$show['member']">
                                                        <li>
                                                                <a href="profile.php?{vb:raw session.sessionurl}do=editoptions">{vb:rawphrase edit_options}</a>
                                                        </li>
                                                        <li>
                                                                <a href="profile.php?{vb:raw session.sessionurl}do=editprofile">{vb:rawphrase edit_your_details}</a>
                                                        </li>
                                                        </vb:if>
                                                </ul>
                                        </li>
                                        <li class="popupmenu">
                                                <a href="javascript://" class="popupctrl" accesskey="3">{vb:rawphrase quick_links}</a>
                                                <ul class="popupbody popuphover">
                                                        <vb:if condition="$show['member']">
                                                                <li><a href="{vb:link subscription}" rel="nofollow">{vb:rawphrase subscribed_threads}</a></li>
                                                                <li><a href="javascript://" onclick="window.open(getBaseUrl() + 'misc.php?{vb:raw session.sessionurl}do=buddylist&amp;focus=1','buddylist','statusbar=no,menubar=no,toolbar=no,scrollbars=yes,resizable=yes,width=250,height=300'); return false;">{vb:rawphrase open_contacts}</a></li>
                                                        </vb:if>
                                                        <vb:if condition="$vboptions['forumleaders']">
                                                        <li><a href="showgroups.php{vb:raw session.sessionurl_q}" rel="nofollow">
                <vb:if condition="$vb_suite_installed">
                        {vb:rawphrase view_site_leaders}
                <vb:else />
                        {vb:rawphrase view_forum_leaders}
                </vb:if>
        </a></li>
                                                        </vb:if>
                                                        {vb:raw template_hook.navbar_quick_links_menu_pos1}
                                                        {vb:raw template_hook.navbar_quick_links_menu_pos2}
                                                        {vb:raw template_hook.navbar_quick_links_menu_pos3}
                                                        <vb:if condition="$show['wollink']">
                                                                <li><a href="online.php{vb:raw session.sessionurl_q}">{vb:rawphrase whos_online}</a></li>
                                                        </vb:if>
                                                        {vb:raw template_hook.navbar_quick_links_menu_pos4}
                                                </ul>
                                        </li>
                                        {vb:raw template_hook.navbar_end}
                                </ul>

                        </li>
                <vb:else />
                        <li><a class="navtab" href="{vb:link forumhome}">{vb:rawphrase forum}</a></li>
                </vb:if>
                {vb:raw template_hook.navtab_middle}
<li>
<script language="JavaScript" type="text/javascript" src="http://www.rkempo.nl/prochatrooms/chat.js"></script>
<a href="javascript:launchChat();"><b>Chat</b></a>
</td>
</li>
                <vb:if condition="!$vboptions['selectednavtab'] AND THIS_SCRIPT == 'search'">
                        <vb:if condition="$show['member']">
                        <li  class="selected"><a class="navtab" href="search.php?{vb:raw session.sessionurl}do=getnew&amp;contenttype=vBForum_Post" accesskey="2">{vb:rawphrase getnew_tab}</a>
                                <ul class="floatcontainer">
                                        <li><a href="search.php?{vb:raw session.sessionurl}do=getnew&amp;contenttype=vBForum_Post">{vb:rawphrase new_posts_nav}</a></li>
                                        <li><a href="search.php?{vb:raw session.sessionurl}do=getnew&amp;contenttype=vBForum_SocialGroupMessage">{vb:rawphrase new_group_messages_nav}</a></li>
                                        <li><a href="search.php?{vb:raw session.sessionurl}do=getnew&amp;contenttype=vBForum_Event">{vb:rawphrase new_events_nav}</a></li>
                                        {vb:raw template_hook.navbar_getnew_menu}
                                        <li><a href="{vb:raw $vboptions.vbforum_url}{vb:if "$vboptions['vbforum_url']", '/', ''}forumdisplay.php?{vb:raw session.sessionurl}do=markread&amp;markreadhash={vb:raw bbuserinfo.securitytoken}">{vb:rawphrase mark_forums_read}</a></li>
                                </ul>
                        </li>
                        <vb:else />
                        <li  class="selected"><a class="navtab" href="search.php?{vb:raw session.sessionurl}do=getdaily&amp;contenttype=vBForum_Post" accesskey="2">{vb:rawphrase getnew_tab}</a>
                                <ul class="floatcontainer">
                                        <li><a href="search.php?{vb:raw session.sessionurl}do=getdaily&amp;contenttype=vBForum_Post">{vb:rawphrase todays_posts}</a></li>
                                        <li><a href="search.php?{vb:raw session.sessionurl}do=getdaily&amp;contenttype=vBForum_SocialGroupMessage">{vb:rawphrase daily_group_message}</a></li>
                                        <li><a href="search.php?{vb:raw session.sessionurl}do=getdaily&amp;contenttype=vBForum_Event">{vb:rawphrase daily_events}</a></li>
                                        {vb:raw template_hook.navbar_getdaily_menu}
                                        <li><a href="{vb:raw $vboptions.vbforum_url}{vb:if "$vboptions['vbforum_url']", '/', ''}forumdisplay.php?{vb:raw session.sessionurl}do=markread&amp;markreadhash={vb:raw bbuserinfo.securitytoken}">{vb:rawphrase mark_forums_read}</a></li>
                                </ul>
                        </li>
                        </vb:if>
                <vb:elseif condition="$show['member']" />
                        <li><a class="navtab" href="search.php?{vb:raw session.sessionurl}do=getnew&amp;contenttype=vBForum_Post" accesskey="2">{vb:rawphrase getnew_tab}</a></li>
                <vb:else />
                        <li><a class="navtab" href="search.php?{vb:raw session.sessionurl}do=getdaily&amp;contenttype=vBForum_Post" accesskey="2">{vb:rawphrase getnew_tab}</a></li>
                </vb:if>
                {vb:raw template_hook.navtab_end}
        </ul>

        <vb:if condition="$vboptions['enablesearches']">


        <div id="searchBox" class="searchBox">


                <form action="search.php?do=process" method="post">
                        <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="searchBox_container"><input type="text" value="" class="textbox" name="query" tabindex="99"/></span>
                        <span class="searchBox_button"><input type="image" src="{vb:stylevar imgdir_button}/search.png" name="submit" onclick="document.getElementById('navbar_search').submit;" tabindex="100"/></span>
                </form>
        </div>
        </vb:if>
</div></div>
</div>
</div><!-- closing div for above_body -->
<!-- Custom Content Wrap -->
                <div id="contentMain">
<!-- Custom Content Wrap End -->

<div class="body_wrapper">
<div id="breadcrumb" class="breadcrumb">
<div class="bcLeft"><div class="bcRight">
        <ul class="floatcontainer">
                <li class="navbithome"><a href="index.php{vb:raw session.sessionurl_q}" accesskey="1"><img src="{vb:stylevar imgdir_misc}/navbit-home.png" alt="{vb:rawphrase home}" /></a></li>

                {vb:raw navbits.breadcrumb}
                {vb:raw navbits.lastelement}
        </ul>
        <hr />
</div></div>
</div>

{vb:raw ad_location.ad_navbar_below}
{vb:raw ad_location.global_below_navbar}
{vb:raw vsa_flashimagebanners}

<vb:if condition="$show['notices'] AND THIS_SCRIPT != 'register'">
        <form action="profile.php?do=dismissnotice" method="post" id="notices" class="notices">
                <input type="hidden" name="do" value="dismissnotice" />
                <input type="hidden" name="s" value="{vb:raw session.sessionurl}" />
                <input type="hidden" name="securitytoken" value="{vb:raw bbuserinfo.securitytoken}" />
                <input type="hidden" id="dismiss_notice_hidden" name="dismiss_noticeid" value="" />
                <input type="hidden" name="url" value="{vb:raw return_link}" />
                <ol>
                        {vb:raw notices}
                </ol>
        </form>
</vb:if>


obmob 06-13-2011 08:34 PM

Maybe you need to revert that template. o.o

temsamane 06-14-2011 11:18 AM

i reverted the navbar page. now i did everything fine, but get a google error

Your client has issued a malformed or illegal request.

temsamane 06-14-2011 11:24 AM

Quote:

Originally Posted by BlueCheri (Post 2207031)
Hi very nice, installed.

Getting following error;

400. That?s an error.
Your client has issued a malformed or illegal request. That?s all we know.


Using 4.1.2 version, Can you help me on this?

i've got the same problem. and the search page layout is messed up (footer not visible).

BlueCheri 06-14-2011 12:07 PM

Footer is visible in my case.

synseal 06-17-2011 11:24 AM

Quote:

Originally Posted by temsamane (Post 2207541)
i've got the same problem. and the search page layout is messed up (footer not visible).

Footer visible but same error on 4.1.4

400. That?s an error.
Your client has issued a malformed or illegal request. That?s all we know.


Shame :(.

bosken 06-17-2011 01:51 PM

1 Attachment(s)
Works fine on 4.1.4

BUT is there a way, how and where to change/remove the "google custom search gif" in the search field. Users THINK that its ONLY a regular google search.... I would like my own text like "Search the forum"

"<input type="text" class="textbox" name="q" value="" style="border: 1px solid rgb(126, 157, 185); padding: 2px; background: url(&quot;[url]http ://www.google.com/cse/intl/en/images/google_custom_search_watermark.gif&quot; ) no-repeat scroll left center rgb(255, 255, 255);">"

ARSamo 06-21-2011 03:14 PM

Error:

404. That’s an error.
The requested URL /cse?cx=partner-pub-xxxxxxxxxxxxxxxxxxx
was not found on this server. That’s all we know.

what can i do now....?

ARSamo 06-21-2011 03:48 PM

another error:

400. That’s an error.
Your client has issued a malformed or illegal request. That’s all we know.

rajubd 06-21-2011 04:17 PM

did you activate AdSense for search from www.google.com/adsense ?

synseal 06-22-2011 11:06 AM

Quote:

Originally Posted by rajubd (Post 2210942)
did you activate AdSense for search from www.google.com/adsense ?

How do you do this, this is not mentioned in the modification, if you mean do I have adsense set up then yes I do, but I wasn't aware that you had to activate AdSense for search?.

TIA.

rajubd 06-22-2011 06:48 PM

in AdSense main dashboard you will find AdSense for content
AdSense for search
AdSense for feed etc

go to AdSense for search complete all step then do this modification

synseal 06-23-2011 08:05 PM

1 Attachment(s)
Done all that now, thanks for your help but this unfortunatley does not work with 4.1.4.

All I get is this (pic).

the closest I get is if I replace the pub ID with the actual snippit from google but then I have 2 search boxes.

I am pretty good when it comes to installing template mods so I dont know why this isn't working for me?.

synseal 07-05-2011 01:29 PM

1 Attachment(s)
Got it working, I was putting the wrong pub id in.

I was using the one in the top right hand corner when signed into adsense instead of the one in the code given :o

Installed.

Crotan 07-06-2011 07:49 PM

While looking at your site as a demo (http://www.mobilephonetalk.com), I did a search but results on pages past the first tended to have buggy results.

I'm using Google Chrome, and there were gaps and white spaces between results but then I highlighted the text and it appeared. kinda wonky?

radiofranky 07-06-2011 10:45 PM

the search result should be blend in with forum style, not as a google page.

cheers

synseal 07-07-2011 07:15 AM

Quote:

Originally Posted by Crotan (Post 2217521)
While looking at your site as a demo (http://www.mobilephonetalk.com), I did a search but results on pages past the first tended to have buggy results.

I'm using Google Chrome, and there were gaps and white spaces between results but then I highlighted the text and it appeared. kinda wonky?

Strange, it seems fine at my end?.

Crotan 07-07-2011 08:42 PM

Quote:

Originally Posted by synseal (Post 2217686)
Strange, it seems fine at my end?.

https://vborg.vbsupport.ru/external/2011/07/46.png

baghdad4ever 07-08-2011 06:14 PM

doesn't worked

appsfinder 07-15-2011 06:39 PM

Quote:

Originally Posted by baghdad4ever (Post 2218273)
doesn't worked

works fine in 4.1.4

Crotan 07-15-2011 08:50 PM

Anybody else have another demo? of this working, the coders website has buggy results for me on Chrome

rajubd 07-17-2011 01:33 PM

1 Attachment(s)
Quote:

Originally Posted by Crotan (Post 2220989)
Anybody else have another demo? of this working, the coders website has buggy results for me on Chrome

unable to find bug working well on 4.1.4 with Google Chrome
https://vborg.vbsupport.ru/external/2011/08/79.jpg
https://vborg.vbsupport.ru/external/2011/08/79.jpg

synseal 07-18-2011 08:49 AM

Another demo http://www.techkings.org/forum/

Crotan 07-25-2011 03:24 PM

Quote:

Originally Posted by rajubd (Post 2221469)
unable to find bug working well on 4.1.4 with Google Chrome

Look at results on pages past the first using chrome on your website. For some reason, there are gaps in the search results.

Quote:

Originally Posted by synseal (Post 2221849)

However, yours is fine for me, so maybe just a website issue instead of a incompatibility with chrome.

Thanks

DNN 08-03-2011 09:10 PM

Quote:

Originally Posted by rajubd (Post 2221469)



followed your instructions and uploaded google.php to web root. when a test search is performed, the screen just goes blank. is running vB 4.1.3.


what else needs to be done so it can work?

DNN 08-03-2011 09:23 PM

Quote:

Originally Posted by rajubd (Post 2221469)

not working on 4.1.3. Try searching on DNN and see that the search results come up blank. google.php is officially uploaded to root , and all other instructions are followed. what can be done now to make this work?


All times are GMT. The time now is 06:28 PM.

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.01581 seconds
  • Memory Usage 1,919KB
  • 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
  • (3)bbcode_code_printable
  • (15)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)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