Page 1 of 4

Google Adsense Search

Posted: 10 Mar 2010, 23:14
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
(1.43 KiB) Downloaded 840 times
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

Re: Google Adsense Search

Posted: 09 May 2010, 13:29
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?

Re: Google Adsense Search

Posted: 09 May 2010, 21:28
by Stoker
You set the bckground color in your adsense account.

Re: Google Adsense Search

Posted: 09 May 2010, 21:31
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

Re: Google Adsense Search

Posted: 09 May 2010, 21:54
by Stoker
Then you are not changing the search you are using, or you are not saving.

Re: Google Adsense Search

Posted: 09 May 2010, 22:15
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]

Re: Google Adsense Search

Posted: 10 May 2010, 16:57
by eVoLuTiOnBOyz
hey stroker will we earn from this?
if yes then how much $ or cents. per search.

Re: Google Adsense Search

Posted: 10 May 2010, 17:00
by cisco007
eVoLuTiOnBOyz, read here! https://www.google.com/adsense

Re: Google Adsense Search

Posted: 12 May 2010, 20:38
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

Posted: 12 May 2010, 20:45
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?