Google Adsense Search

Modifications for phpBB3.
Try the Mods here and share Your own Mods
Forum rules
You dont have to use ModX or make your mod AutoMod compatible. A simple textfile is fine
But if you post Mods here You also have to give support

Google Adsense Search

Post by Stoker »

Title: Google Adsense Search
Version: 1.0.0
Author: Stoker
MOD description: With this phpBB3 mod installed the standard searchbar in the header will be replaced with a google sitesearch with adsense in the search result page.
Note! Prosilver only
Demo: This site
Attached file:
googlesearch.zip
Download, unzip and upload the files the their right location.
Installation instructions: The first thing to do is to create a search engine with your adsense account.
If you don't have an adsense account, you can create one here: http://www.google.com/coop/cse/ Its free
You need the code generated by google

Open language/en/common.php
Find:

Code: Select all

'GO'						=> 'Go',
add after, on a new line:

Code: Select all

'GOOGLESEARCH'					    => 'Google Search',
Open styles/prosilver/template/overall_header.html
Find:

Code: Select all

<form action="{U_SEARCH}" method="post" id="search">
				<fieldset>
					<input name="keywords" id="keywords" type="text" maxlength="128" title="{L_SEARCH_KEYWORDS}" class="inputbox search" value="<!-- IF SEARCH_WORDS-->{SEARCH_WORDS}<!-- ELSE -->{L_SEARCH_MINI}<!-- ENDIF -->" onclick="if(this.value=='{LA_SEARCH_MINI}')this.value='';" onblur="if(this.value=='')this.value='{LA_SEARCH_MINI}';" /> 
					<input class="button2" value="{L_SEARCH}" type="submit" /><br />
					<a href="{U_SEARCH}" title="{L_SEARCH_ADV_EXPLAIN}">{L_SEARCH_ADV}</a> {S_SEARCH_HIDDEN_FIELDS}
				</fieldset>
				</form>
Replace with:

Code: Select all

<form action="http://www.your_domain.com/googlesearch.php" id="cse-search-box">
  <fieldset>
    <input type="hidden" name="cx" value="partner-pub-3346231937490093:rf17b3yseht" />
    <input type="hidden" name="cof" value="FORID:9" />
    <input type="hidden" name="ie" value="UTF-8" />
    <input type="text" class="inputbox search" name="q" maxlength="128" value="<!-- IF SEARCH_WORDS-->{SEARCH_WORDS}<!-- ELSE -->{L_SEARCH_MINI}<!-- ENDIF -->" onclick="if(this.value=='{LA_SEARCH_MINI}')this.value='';" onblur="if(this.value=='')this.value='{LA_SEARCH_MINI}';" /><br />
  <a href="{U_SEARCH}" title="{L_SEARCH_ADV_EXPLAIN}">{L_SEARCH_ADV}</a> {S_SEARCH_HIDDEN_FIELDS}
  </fieldset>
</form>
In the above code there is 3 things you need to edit so your own adsense code will be used.
Change your domain name in this:

Code: Select all

<form action="http://www.your_domain.com/googlesearch.php" id="cse-search-box">
Change to the code generated by google here:

Code: Select all

<input type="hidden" name="cx" value="partner-pub-3346231937490093:rf17b3yseht" />
The same here:

Code: Select all

<input type="hidden" name="cof" value="FORID:9" />
Open the included template file and insert your search result code

Save, upload and refresh template
You do not have the required permissions to view the files attached to this post.

Re: Google Adsense Search

Post by Fire-Fox »

How do i get transparant ?

i have white background color when the search result is displayed

when i do this:

Code: Select all

				<form action="http://www.phpbb3addons.com/googlesearch.php" id="cse-search-box">
  <fieldset>
    <input type="hidden" name="cx" value="partner-pub-013451510553273018505:5kwgbpknx7s" />
    <input type="hidden" name="cof" value="FORID:9" />
    <input type="hidden" name="ie" value="UTF-8" />
    <input type="text" class="inputbox search" name="q" maxlength="128" value="<!-- IF SEARCH_WORDS-->{SEARCH_WORDS}<!-- ELSE -->{L_GOOGLE_MINI}<!-- ENDIF -->" onclick="if(this.value=='{LA_GOOGLE_MINI}')this.value='';" onblur="if(this.value=='')this.value='{LA_GOOGLE_MINI}';" /><br />
  </fieldset>
</form>
i get and error, cannot be found on server ?

when i do:

Code: Select all

				<form action="http://www.phpbb3addons.com/googlesearch.php" id="cse-search-box">
  <fieldset>
    <input type="hidden" name="cx" value="013451510553273018505:5kwgbpknx7s" />
    <input type="hidden" name="cof" value="FORID:9" />
    <input type="hidden" name="ie" value="UTF-8" />
    <input type="text" class="inputbox search" name="q" maxlength="128" value="<!-- IF SEARCH_WORDS-->{SEARCH_WORDS}<!-- ELSE -->{L_GOOGLE_MINI}<!-- ENDIF -->" onclick="if(this.value=='{LA_GOOGLE_MINI}')this.value='';" onblur="if(this.value=='')this.value='{LA_GOOGLE_MINI}';" /><br />
  </fieldset>
</form>
it work?
Last edited by Fire-Fox on 09 May 2010, 13:51, edited 2 times in total.

Re: Google Adsense Search

Post by Stoker »

You set the bckground color in your adsense account.

Re: Google Adsense Search

Post by Fire-Fox »

i have tryed, but it dosn't change :(

it's in this link right : https://www.google.com/adsense/colors
Adsense.png
You do not have the required permissions to view the files attached to this post.

Re: Google Adsense Search

Post by Stoker »

Then you are not changing the search you are using, or you are not saving.

Re: Google Adsense Search

Post by Fire-Fox »

Got it working

What is the color text of this in the adsense change color (hr line - marked with red arrows) :
Adsense1.png
FIXED:
Adsense1.png
New issue
search.png
[edit]all issues fixed[/edit]
You do not have the required permissions to view the files attached to this post.
Last edited by Fire-Fox on 10 May 2010, 20:49, edited 1 time in total.

Re: Google Adsense Search

Post by eVoLuTiOnBOyz »

hey stroker will we earn from this?
if yes then how much $ or cents. per search.

Re: Google Adsense Search

Post by cisco007 »

eVoLuTiOnBOyz, read here! https://www.google.com/adsense

Re: Google Adsense Search

Post by onel0ve »

when i am click on search always showing Insert your googlecode here please help me

me already paste my code

Code: Select all

<form action="http://localhost/googlesearch.php" id="cse-search-box">
  <fieldset>
    <input type="hidden" name="cx" value="partner-pub-0887266645916706:5f8lmp-uywf" />
    <input type="hidden" name="ie" value="ISO-8859-1" />
    <input type="hidden" name="ie" value="UTF-8" />
    <input type="text" class="inputbox search" name="q" maxlength="128" value="<!-- IF SEARCH_WORDS-->{SEARCH_WORDS}<!-- ELSE -->{L_SEARCH_MINI}<!-- ENDIF -->" onclick="if(this.value=='{LA_SEARCH_MINI}')this.value='';" onblur="if(this.value=='')this.value='{LA_SEARCH_MINI}';" />
  </fieldset>
</form>

Re: Google Adsense Search

Post by cisco007 »

are you using this on your localhost? have you tried using this on a live site and creating a adsense code for the live site, and then checking?