vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Modification Requests/Questions (Unpaid) (https://vborg.vbsupport.ru/forumdisplay.php?f=112)
-   -   Google Search Mod that Actually WORKS! (https://vborg.vbsupport.ru/showthread.php?t=314370)

Nelson58 09-18-2014 07:39 PM

No joy. It still goes to Google page:



Navbar:

Code:

<div id="navbar" class="navbar">
        <ul id="navtabs" class="navtabs floatcontainer<vb:if condition="$show['member'] AND $notifications_total"> notify</vb:if>">
                {vb:raw template_hook.}
                {vb:raw navigation}
                {vb:raw template_hook.navtab_end}
        </ul>


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

<div id="globalsearch" class="globalsearch">

<gcse:searchbox-only></gcse:searchbox-only>
<form method="get" action="http://www.hobby-machinist.com/google.php" target="_blank" class="navbar_search">
            <input type="hidden" name="sitesearch" value="hobby-machinist.com/forum.php"  id="pn"/>       
        <input type="hidden" name="domains" value="hobby-machinist.com/forum.php"/>
</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:raw template_hook.navbar_advanced_search}
                        </ul>                       
                </div>
        </vb:if>
</div>


</div><!-- closing div for above_body -->


<div class="body_wrapper">
<div id="breadcrumb" class="breadcrumb">
        <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>

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

<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>


dbtech_vbnavtabs_navbar:

Code:

<div id="navbar" class="navbar">
        <ul id="navtabs" class="navtabs floatcontainer<vb:if condition="$show['member'] AND $notifications_total"> notify</vb:if>">
                {vb:raw template_hook.navtab_start}
                {vb:raw navigation}
                {vb:raw template_hook.navtab_end}

<vb:if condition="$vboptions['dbtech_vbnavtabs_420_search_tab']">
<vb:if condition="(is_member_of($bbuserinfo, $vboptions['dbtech_vbnavtabs_420_guests_search_tab']))">
            <vb:if condition="$vboptions['dbtech_vbnavtabs_420_hover']">
            <li class="popupmenu hovermenu forumsearch menusearch" id="forumsearch">
            <vb:else />
            <li class="popupmenu forumsearch menusearch" id="forumsearch">
            </vb:if>
                                <h6><a href="javascript://" class="popupctrl navtab" style="color:{vb:raw vboptions.dbtech_vbnavtabs_420_search_color};">
                    <vb:if condition="$vboptions['dbtech_vbnavtabs_420_search_tab_image']"><img src="dbtech/vbnavtabs_420/images/{vb:raw vboptions.dbtech_vbnavtabs_420_search_img_img}"  style="margin-bottom:.25em; vertical-align:middle; padding:{vb:stylevar dbtech_vbnavtabs_420_image_padding};" ></vb:if>{vb:rawphrase dbtech_vbnavtabs_420_search}<img src="images/misc/arrow.png" style="margin-bottom:.25em; vertical-align:middle; padding-left:2px; margin-right:-10px;" ></a></h6>
                                        <form action="search.php?do=process" method="get">
                                                <ul class="popupbody popuphover">
                                                        <li><input type="text" class="searchbox" name="query" value="{vb:rawphrase dbtech_vbnavtabs_420_search_search}" tabindex="1" /></li>
                                                            <li class="formsubmit">
                                                        <input type="submit" class="button" value="{vb:rawphrase dbtech_vbnavtabs_420_search_button}" tabindex="2" />
                                                </li>
                                        <li class="formsubmit">
                                                <div class="submitoptions">
                                                        <label><input type="radio" name="showposts" value="0" checked="checked" /> {vb:rawphrase dbtech_vbnavtabs_420_show_threads}</label>
                                                        <label><input type="radio" name="showposts" value="1" /> {vb:rawphrase dbtech_vbnavtabs_420_show_posts}</label>
                                                </div>
                                                <div class="advancedsearchlink"><a href="search.php?">{vb:rawphrase dbtech_vbnavtabs_420_advanced_search}</a></div>

                                        </li>
                                </ul>
                                <input type="hidden" name="s" value="{vb:raw session.sessionhash}" />
                                <input type="hidden" name="securitytoken" value="{vb:raw bbuserinfo.securitytoken}" />
                                <input type="hidden" name="do" value="process" />
                                <input type="hidden" name="contenttype" value="vBForum_Post" />
                                <input type="hidden" name="exactname" value="1" />
                                </form>
                        </li>
</vb:if>
</vb:if>

        </ul>
<vb:if condition="!$vboptions['dbtech_vbnavtabs_420_hide_search']">
        <vb:if condition="$vboptions['enablesearches']">
                <div id="globalsearch" class="globalsearch">
                        <gcse:searchbox-only></gcse:searchbox-only>
                        <form method="get" action="http://www.hobby-machinist.com/google.php" target="_blank" class="navbar_search">
            <input type="hidden" name="sitesearch" value="hobby-machinist.com/forum.php"  id="pn"/>
           
        <input type="hidden" name="domains" value="hobby-machinist.com/forum.php"/>
</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>
                                {vb:raw template_hook.navbar_advanced_search}
                        </ul>
                </div>
        </vb:if>
</div>

{vb:raw template_hook.navtab_multi}
{vb:raw template_hook2.navtab_multi}

</div><!-- closing div for above_body -->

<div class="body_wrapper">
<div id="breadcrumb" class="breadcrumb">
        <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>

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

<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>


CAG CheechDogg 09-18-2014 08:15 PM

Hmm...weird...go back to the google.php file and lave the following like you see it below and dont put google where it says "test" .... I just tried this on a new style and it worked .... I don't see why it doesn't work on your site ...

define('THIS_SCRIPT', 'test');
define('CSRF_PROTECTION', true);

--------------- Added [DATE]1411075097[/DATE] at [TIME]1411075097[/TIME] ---------------

Quote:

Originally Posted by Nelson58 (Post 2515572)
Entered everything exactly. Named the .PHP file "google.php" and changed the line from 'test' to 'google' as required.

Nothing is showing up on the page. I checked the Google code and it is correct. I entered my code exactly as from the Google site. I must be doing something wrong. Is there anything I should try?

What code from the Google site are you talking about? You shouldn't be adding any extra code but what I gave you .... the line from "test" to "google" is not required either ...

--------------- Added [DATE]1411076426[/DATE] at [TIME]1411076426[/TIME] ---------------

Ok I might of found the problem:

In your headinclude make sure the code looks like this:

Code:

<!-- google cse -->
<script>
  (function() {
    var cx = 'partner-pub-014891898195566079264:j9p1m_ucz0q'; ///////////////CHANGE THIS TO YOUR OWN ID ////
    var gcse = document.createElement('script');
    gcse.type = 'text/javascript';
    gcse.async = true;
    gcse.src = (document.location.protocol == 'https' ? 'https:' : 'http:') +
        '//www.google.com/cse/cse.js?cx=' + cx;
    var s = document.getElementsByTagName('script')[0];
    s.parentNode.insertBefore(gcse, s);
  })();
</script>
<!-- / google cse -->

Your id should look like this: partner-pub-014891898195566079264:j9p1m_ucz0q

in yours you left out the "partner-pub" in your id ....

Nelson58 09-19-2014 11:45 AM

When I put the "partner-pub" in, it doesn't work at all, the box doesn't even appear.

Code:

<meta http-equiv="Content-Type" content="text/html; charset={vb:stylevar charset}" />
<meta id="e_vb_meta_bburl" name="vb_meta_bburl" content="{vb:raw vboptions.bburl}" />
<base href="{vb:raw basepath}" /><!--[if IE]></base><![endif]-->
<meta name="generator" content="vBulletin {vb:raw vboptions.templateversion}" />
<meta http-equiv="X-UA-Compatible" content="IE=9" />
<vb:if condition="$stylevar['favicon']">
        <link rel="Shortcut Icon" href="{vb:stylevar favicon}" type="image/x-icon" />
</vb:if>
<vb:if condition="$show['threadinfo']">

<vb:elseif condition="$show['foruminfo']" />
                <meta name="keywords" content="{vb:raw foruminfo.title_clean}, {vb:raw vboptions.keywords}" />
                <meta name="description" content="<vb:if condition="$pagenumber > 1">{vb:rawphrase page_x, {vb:raw pagenumber}}-</vb:if>{vb:raw foruminfo.description_clean}" />
<vb:else />
                <meta name="keywords" content="{vb:raw vboptions.keywords}" />
                <meta name="description" content="{vb:raw vboptions.description}" />
</vb:if>

<vb:if condition="$show['fb_opengraph']">
        {vb:raw facebook_opengraph}
</vb:if>

<vb:if condition="$show['remoteyui']">
        <vb:if condition="$show['remoteyuicombo']">
                <script type="text/javascript" src="{vb:stylevar yuicombopath}?{vb:stylevar yuiversion}/build/yuiloader-dom-event/yuiloader-dom-event.js&amp;{vb:stylevar yuiversion}/build/connection/connection-min.js"></script>
        <vb:else />
                <script type="text/javascript" src="{vb:stylevar yuipath}/yuiloader-dom-event/yuiloader-dom-event.js"></script>
        </vb:if>
</vb:if>
<script type="text/javascript">
<!--
        if (typeof YAHOO === 'undefined') // Load ALL YUI Local
        {
                document.write('<script type="text/javascript" src="clientscript/yui/yuiloader-dom-event/yuiloader-dom-event.js?v={vb:raw vboptions.simpleversion}"><\/script>');
                document.write('<script type="text/javascript" src="clientscript/yui/connection/connection-min.js?v={vb:raw vboptions.simpleversion}"><\/script>');
                var yuipath = 'clientscript/yui';
                var yuicombopath = '';
                var remoteyui = false;
        }
        else        // Load Rest of YUI remotely (where possible)
        {
                var yuipath = '{vb:stylevar yuipath}';
                var yuicombopath = '{vb:stylevar yuicombopath}';
                var remoteyui = true;
                if (!yuicombopath)
                {
                        document.write('<script type="text/javascript" src="{vb:stylevar yuipath}/connection/connection-min.js?v={vb:raw vboptions.simpleversion}"><\/script>');
                }
        }
        var SESSIONURL = "{vb:raw session.sessionurl_js}";
        var SECURITYTOKEN = "{vb:raw bbuserinfo.securitytoken}";
        var IMGDIR_MISC = "{vb:stylevar imgdir_misc}";
        var IMGDIR_BUTTON = "{vb:stylevar imgdir_button}";
        var vb_disable_ajax = parseInt("{vb:raw vboptions.disable_ajax}", 10);
        var SIMPLEVERSION = "{vb:raw vboptions.simpleversion}";
        var BBURL = "{vb:raw vboptions.bburl}";
        var LOGGEDIN = {vb:raw bbuserinfo.userid} > 0 ? true : false;
        var THIS_SCRIPT = "{vb:raw this_script}";
        var RELPATH = "{vb:raw relpath}";
        var PATHS = {
                forum : "{vb:raw vboptions.vbforum_url}",
                cms  : "{vb:raw vboptions.vbcms_url}",
                blog  : "{vb:raw vboptions.vbblog_url}"
        };
        var AJAXBASEURL = "{vb:raw ajaxbaseurl}";
// -->
</script>
<script type="text/javascript" src="{vb:raw vboptions.bburl}/clientscript/vbulletin-core.js?v={vb:raw vboptions.simpleversion}"></script>
{vb:raw template_hook.headinclude_javascript}

<vb:if condition="$vboptions['externalrss']">
        <link rel="alternate" type="application/rss+xml" title="{vb:raw vboptions.bbtitle} {vb:rawphrase rss_feed}" href="{vb:raw vboptions.bburl}/external.php?type=RSS2" />
        <vb:if condition="$show['foruminfo'] OR $show['threadinfo']">
                <link rel="alternate" type="application/rss+xml" title="{vb:raw vboptions.bbtitle} - {vb:raw foruminfo.title_clean} - {vb:rawphrase rss_feed}" href="{vb:raw vboptions.bburl}/external.php?type=RSS2&amp;forumids={vb:raw foruminfo.forumid}" />
        </vb:if>
</vb:if>

<vb:if condition="$vboptions['storecssasfile']">
        {vb:cssfile main-rollup.css}
        {vb:raw template_hook.custom_css_links}
<vb:else />
        {vb:cssfile bbcode.css,editor.css,popupmenu.css,reset-fonts.css,vbulletin.css,vbulletin-chrome.css,vbulletin-formcontrols.css{vb:raw template_hook.custom_css_list}}
</vb:if>
        <!--[if lt IE 8]>
        {vb:cssfile popupmenu-ie.css,vbulletin-ie.css,vbulletin-chrome-ie.css,vbulletin-formcontrols-ie.css,editor-ie.css}
        <![endif]-->
{vb:raw template_hook.headinclude_css}

<!-- google cse -->
<script>
  (function() {
    var cx = 'partner-pub-014891898195566079264:j9p1m_ucz0q'; ///////////////CHANGE THIS TO YOUR OWN ID ////
    var gcse = document.createElement('script');
    gcse.type = 'text/javascript';
    gcse.async = true;
    gcse.src = (document.location.protocol == 'https' ? 'https:' : 'http:') +
        '//www.google.com/cse/cse.js?cx=' + cx;
    var s = document.getElementsByTagName('script')[0];
    s.parentNode.insertBefore(gcse, s);
  })();
</script>
<!-- / google cse -->

I changed "google" to "test" in the google.php file and it made no difference. It still goes to the Google page.

tpearl5 09-19-2014 04:16 PM

Quote:

Originally Posted by CAG CheechDogg (Post 2515643)

Your id should look like this: partner-pub-014891898195566079264:j9p1m_ucz0q

in yours you left out the "partner-pub" in your id ....


The newer ID's do not include partner-pub. I learned this after making my see more custom google search modification.

CAG CheechDogg 09-19-2014 08:36 PM

Quote:

Originally Posted by tpearl5 (Post 2515780)
The newer ID's do not include partner-pub. I learned this after making my see more custom google search modification.

I have the "partner-pub" included and it works for me ..that is the only thing I can think of that is keeping it from working ... I removed it from mine and it didn't work it went to the google search intead of the google.php page on my site ... so I don't know ....

Nelson58 09-20-2014 12:39 PM

Could it be interference from the DBtech Navan mod somewhere? It is still going to the Google page.

If you are stumped, then I am certainly done.

--------------- Added [DATE]1411272699[/DATE] at [TIME]1411272699[/TIME] ---------------

Looks like we're stumped.

Nelson58 09-22-2014 03:36 PM

OMG, everyone is stumped?

(Faints)

mokujin 09-22-2014 08:09 PM

I don't know what's your problem, but test at my site: http://www.vuive.info/diendan/misc.p...-8&do=googlecs
Type anything, or type "Tieu Bao" for a test. Google Custom Search work fine for me :-)

Nelson58 09-22-2014 11:46 PM

Can I see your template and PHP code?

mokujin 09-23-2014 05:54 AM

1 Attachment(s)
This is my plugin, install and paste your Google search ID in vB Options -> Message Searching Options, there is a setting for Google Custom Search.
Edit navbar template, edit <form> search to this:

PHP Code:

            <form action="misc.php?do=googlecs" id="cse-search-box" class="navbar_search">
                <
input type="hidden" name="do" value="googlecs" />
                <
span class="textboxcontainer"><span><input type="text" name="q" class="textbox" tabindex="99"/></span></span>
                        <
input type="hidden" name="ie" value="UTF-8" />
                <
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)">gif<vb:else />png</vb:if>" name="submit" onclick="document.getElementById('navbar_search').submit;" tabindex="100"/></span></span>
            </
form

I've used this for years ago (I closed my forum a year ago) :D
Good luck :D


All times are GMT. The time now is 03:38 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.01340 seconds
  • Memory Usage 1,838KB
  • 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
  • (4)bbcode_code_printable
  • (1)bbcode_php_printable
  • (3)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)pagenav_pagelink
  • (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