Not Solved [How To?] Add Google Custom Search to Header
#1
Not Solved
I am looking to add a Google custom search box next to my ad banner in the header template but I am not stellar with html and I can't seem to get it to float right!  When I add the search script, it adds it to the right side of the nav bar!  Close, but I need it to go up and be to the right of the centered banner ad!  Any help would be greatly appreciated and rewarded with positive feedback!   Big Grin

See screen cap below for reference:
   
MyBB 1.8.38 (x3)
bladetalk.org, alpharomeo15.org & pazrt.com
Reply
#2
Not Solved
Anyone good with element placement?  Just need a little guidance here...
MyBB 1.8.38 (x3)
bladetalk.org, alpharomeo15.org & pazrt.com
Reply
#3
Not Solved
Did you already build your custom Google search box under:  https://cse.google.com/cse

If you have your embed code I could help you to integrate it into your page. Wink

   
Reply
#4
Not Solved
(2017-02-24, 11:40 PM)SvePu Wrote: Did you already build your custom Google search box under:  https://cse.google.com/cse

If you have your embed code I could help you to integrate it into your page. Wink

Yep...here is the custom search script:

<script>
  (function() {
    var cx = '007957757079081443050:ry9tf_ln-ii';
    var gcse = document.createElement('script');
    gcse.type = 'text/javascript';
    gcse.async = true;
    gcse.src = 'https://cse.google.com/cse.js?cx=' + cx;
    var s = document.getElementsByTagName('script')[0];
    s.parentNode.insertBefore(gcse, s);
  })();
</script>
<gcse:search></gcse:search>

I tried all kinds of float_right, allign, etc...but I am not that good at layouts!  Thanks for the help!!
MyBB 1.8.38 (x3)
bladetalk.org, alpharomeo15.org & pazrt.com
Reply
#5
Not Solved
Ok super!

Could you also post your Flatty header template, please?!
Reply
#6
Not Solved
here is the header temp

<div id="container">
		<a name="top" id="top"></a>
		<div id="header">
			<div id="logo">
				<div class="wrapper">
					<a href="{$mybb->settings['bburl']}/index.php"><img src="{$theme['logo']}" alt="{$mybb->settings['bbname']}" title="{$mybb->settings['bbname']}" /></a>
					
					
					
					
<div class=ads>
<div class="share_index">
<div align="right">



<img src="https://www.7173mustangs.com/images/donate_off.png" style="vertical-align: middle; padding-bottom: 4px; cursor:pointer; -webkit-

transition: color 200ms ease-in;-moz-transition: color 200ms ease-in;-o-transition: color 200ms ease-in;" 

onmouseover="this.src='https://www.7173mustangs.com/images/donate_on.png'" onmouseout="this.src='https://www.7173mustangs.com/images/donate_off.png'" 

onclick="window.open('http://7173mustangs.com/janotas_subscription_page.php')" title="Become a VIP Member, Site Supporter or 7173Mustangs.com Benefactor!  Donate to the forum here!"/>


<img src="https://www.7173mustangs.com/images/twitter_off.png" style="vertical-align: middle; padding-bottom: 4px; cursor:pointer; -webkit-

transition: color 200ms ease-in;-moz-transition: color 200ms ease-in;-o-transition: color 200ms ease-in;" 

onmouseover="this.src='https://www.7173mustangs.com/images/twitter_on.png'" onmouseout="this.src='https://www.7173mustangs.com/images/twitter_off.png'" 

onclick="window.open('https://twitter.com/7173mustangs')" title="7173Mustang's Twitter Page" alt="7173Mustang's Twitter Page"/>


<img src="https://www.7173mustangs.com/images/facebook_off.png" style="vertical-align: middle; padding-bottom: 4px; cursor:pointer; -webkit-

transition: color 200ms ease-in;-moz-transition: color 200ms ease-in;-o-transition: color 200ms ease-in;" 

onmouseover="this.src='https://www.7173mustangs.com/images/facebook_on.png'" onmouseout="this.src='https://www.7173mustangs.com/images/facebook_off.png'" 

onclick="window.open('https://www.facebook.com/groups/7173mustangs/')" title="7173Mustang's Facebook Page" alt="7173Mustang's Facebook Page"/>


<img src="https://www.7173mustangs.com/images/youtube_off.png" style="vertical-align: middle; padding-bottom: 4px; cursor:pointer; -webkit-

transition: color 200ms ease-in;-moz-transition: color 200ms ease-in;-o-transition: color 200ms ease-in;" 

onmouseover="this.src='https://www.7173mustangs.com/images/youtube_on.png'" onmouseout="this.src='https://www.7173mustangs.com/images/youtube_off.png'" 

onclick="window.open('http://www.youtube.com/RocketFoot223')" title="RocketFoot's Youtube Channel'" alt="RocketFoot's Youtube Channel"/>


<img src="https://www.7173mustangs.com/images/googleplus_off.png" style="vertical-align: middle; padding-bottom: 4px; cursor:pointer;" 

onmouseover="this.src='https://www.7173mustangs.com/images/googleplus_on.png'" 

onmouseout="this.src='https://www.7173mustangs.com/images/googleplus_off.png'" onclick="window.open

('https://plus.google.com/u/0/b/115025562687132595379/115025562687132595379/posts')" title="7173Mustang's Google Plus" alt="7173Mustang's Google Plus"/>

</div>
</div>
</div>					
					
					
					
					
					
					
				</div>
			</div>
			<div id="panchor"></div>
			<div id="panel">
				<div class="upper">
					<div class="wrapper">
						{$welcomeblock}
					<!-- </div> in header_welcomeblock_member and header_welcomeblock_guest -->
				<!-- </div> in header_welcomeblock_member and header_welcomeblock_guest -->
			</div>
		</div>
				
						
				
				
		<div id="content">
			<div class="wrapper">
					{$pm_notice}
					{$bbclosedwarning}
					{$unreadreports}
					{$bannedwarning}
					{$pending_joinrequests}
					{$awaitingusers}
				<center>{$banner}</center> <br />

		
				
				<!-- BAM -->{$bam_announcements}<!-- /BAM -->
				<navigation>
				<br />
MyBB 1.8.38 (x3)
bladetalk.org, alpharomeo15.org & pazrt.com
Reply
#7
Not Solved
Ok...thx!

Please replace the whole content of Flatty header template with:
<div id="container">
    <a name="top" id="top"></a>
    <div id="header">
        <div id="logo">
            <div class="wrapper">
                <a href="{$mybb->settings['bburl']}/index.php"><img src="{$theme['logo']}" alt="{$mybb->settings['bbname']}" title="{$mybb->settings['bbname']}" /></a>
                <div class=ads>
                    <div class="share_index">
                        <div align="right">
                            <img src="https://www.7173mustangs.com/images/donate_off.png" style="vertical-align: middle; padding-bottom: 4px; cursor:pointer; -webkit-transition: color 200ms ease-in;-moz-transition: color 200ms ease-in;-o-transition: color 200ms ease-in;" onmouseover="this.src='https://www.7173mustangs.com/images/donate_on.png'" onmouseout="this.src='https://www.7173mustangs.com/images/donate_off.png'" onclick="window.open('http://7173mustangs.com/janotas_subscription_page.php')" title="Become a VIP Member, Site Supporter or 7173Mustangs.com Benefactor!  Donate to the forum here!"/>
                            <img src="https://www.7173mustangs.com/images/twitter_off.png" style="vertical-align: middle; padding-bottom: 4px; cursor:pointer; -webkit-transition: color 200ms ease-in;-moz-transition: color 200ms ease-in;-o-transition: color 200ms ease-in;" onmouseover="this.src='https://www.7173mustangs.com/images/twitter_on.png'" onmouseout="this.src='https://www.7173mustangs.com/images/twitter_off.png'" onclick="window.open('https://twitter.com/7173mustangs')" title="7173Mustang's Twitter Page" alt="7173Mustang's Twitter Page"/>
                            <img src="https://www.7173mustangs.com/images/facebook_off.png" style="vertical-align: middle; padding-bottom: 4px; cursor:pointer; -webkit-transition: color 200ms ease-in;-moz-transition: color 200ms ease-in;-o-transition: color 200ms ease-in;" onmouseover="this.src='https://www.7173mustangs.com/images/facebook_on.png'" onmouseout="this.src='https://www.7173mustangs.com/images/facebook_off.png'" onclick="window.open('https://www.facebook.com/groups/7173mustangs/')" title="7173Mustang's Facebook Page" alt="7173Mustang's Facebook Page"/>
                            <img src="https://www.7173mustangs.com/images/youtube_off.png" style="vertical-align: middle; padding-bottom: 4px; cursor:pointer; -webkit-transition: color 200ms ease-in;-moz-transition: color 200ms ease-in;-o-transition: color 200ms ease-in;" onmouseover="this.src='https://www.7173mustangs.com/images/youtube_on.png'" onmouseout="this.src='https://www.7173mustangs.com/images/youtube_off.png'" onclick="window.open('http://www.youtube.com/RocketFoot223')" title="RocketFoot's Youtube Channel'" alt="RocketFoot's Youtube Channel"/>
                            <img src="https://www.7173mustangs.com/images/googleplus_off.png" style="vertical-align: middle; padding-bottom: 4px; cursor:pointer;" onmouseover="this.src='https://www.7173mustangs.com/images/googleplus_on.png'" onmouseout="this.src='https://www.7173mustangs.com/images/googleplus_off.png'" onclick="window.open('https://plus.google.com/u/0/b/115025562687132595379/115025562687132595379/posts')" title="7173Mustang's Google Plus" alt="7173Mustang's Google Plus"/>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div id="panchor"></div>
        <div id="panel">
            <div class="upper">
                <div class="wrapper">
                    {$welcomeblock}
                    <!-- </div> in header_welcomeblock_member and header_welcomeblock_guest -->
                    <!-- </div> in header_welcomeblock_member and header_welcomeblock_guest -->
                </div>
            </div>
            <div id="content">
                <div class="wrapper">
                    {$pm_notice}
                    {$bbclosedwarning}
                    {$unreadreports}
                    {$bannedwarning}
                    {$pending_joinrequests}
                    {$awaitingusers}
                    <div class="banner_ads">
                        {$banner}
                    </div>
                    <div class=googlesb>
                        <script>
                            (function() {
                                var cx = '007957757079081443050:ry9tf_ln-ii';
                                var gcse = document.createElement('script');
                                gcse.type = 'text/javascript';
                                gcse.async = true;
                                gcse.src = 'https://cse.google.com/cse.js?cx=' + cx;
                                var s = document.getElementsByTagName('script')[0];
                                s.parentNode.insertBefore(gcse, s);
                            })();
                        </script>
                        <gcse:search></gcse:search>
                    </div>
                    <br class="clear" /> 
                    <!-- BAM -->{$bam_announcements}<!-- /BAM -->
                    <navigation>
                    <br />


and add to your Flatty global.css
.googlesb {
    width: 25%;
    float: right;
    margin-top: -30px;
}

.banner_ads {
    display: block;
    text-align: center;
    width: 100%;
}

.gsc-control-cse {
    background-color: transparent !important;
    border: none !important;
    padding: 0 !important;
}

input.gsc-search-button,
input.gsc-search-button:focus {
    border-color: #2c82c9 !important;
    background-color: #2c82c9 !important;
    background-image: none !important;
    filter: none !important;
}

input.gsc-search-button:hover,
input.gsc-search-button:active
{
    opacity: 0.8 !important;
}

input.gsc-input, .gsc-input-box, .gsc-input-box-hover, .gsc-input-box-focus {
    border-color: #d0d3d4 !important;
    border-radius: 2px !important;
}
Reply
#8
Not Solved
Thanks Sven!  Super helpful!!

I am running out of time today...I will implement Monday morning!  I have to leave computer for a while...
MyBB 1.8.38 (x3)
bladetalk.org, alpharomeo15.org & pazrt.com
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)