Apache Forrest Notes
Integration of Google AdSense Search
The following description refers to the replacement of the orignal Forrest Google search facility with Google AdSense SiteSearch.
1. Generate AdSense SiteSearch-Code
Log into your AdSense account and generate code for the AdSense SiteSearch (Choose Search Type: Google WebSearch + SiteSearch). It will look something like this:
<!-- SiteSearch Google --> <form method="get" action="http://www.google.com/custom" target="_top"> <table border="0" bgcolor="#cccccc"> <tr><td nowrap="nowrap" valign="top" align="left" height="32"> </td> <td nowrap="nowrap"> <input type="hidden" name="domains" value="www.erbox.org"></input> <input type="text" name="q" size="31" maxlength="255" value=""></input> <input type="submit" name="sa" value="Google Search"></input> </td></tr> <tr> <td> </td> <td nowrap="nowrap"> <table> <tr> <td> <input type="radio" name="sitesearch" value="" checked="checked"></input> <font size="-1" color="#000000">Web</font> </td> <td> <input type="radio" name="sitesearch" value="www.erbox.org"></input> <font size="-1" color="#000000">www.erbox.org</font> </td> </tr> </table> <input type="hidden" name="client" value="pub-XXXXXXXXXXXXXXXX"></input> <input type="hidden" name="forid" value="1"></input> <input type="hidden" name="channel" value="XXXXXXXXXX"></input> <input type="hidden" name="ie" value="UTF-8"></input> <input type="hidden" name="oe" value="UTF-8"></input> <input type="hidden" name="cof" value="GALT:#008000;GL:1;DIV:#0080 ... "></input> <input type="hidden" name="hl" value="en"></input> </td></tr></table> </form> <!-- SiteSearch Google -->
2. Integrate AdSense SiteSearch-Code into Forrest Stylesheet
Replacing the Forrest Google search with the AdSense Search requires a few further modifications to {FORREST_HOME}\main\webapp\skins\pelt\xslt\html\site2xhtml.xsl:
- Comment out the original code for the Forrest Google Search.
- Add a <div> tag with appropriate CSS class to surround the new SiteSearch code.
- Insert the Google AdSense SiteSearch code.
The resulting code section should look like this:
...
<xsl:otherwise>
<!--
<form class="roundtopsmall" method="get" action="http://www.google.com/search">
<input type="hidden" name="sitesearch" value="{$config/search/@domain}"/>
<input type="text" id="query" name="q" size="25" onFocus="getBlank (this, ...);">
<xsl:attribute name="value"><xsl:value-of select="$search-prompt"/></xsl:attribute>
</input>
<input type="submit" value="Search" name="Search" i18n:attr="value"/> </form>
-->
<div class="roundtopsmall" >
INSERT AdSense-CODE HERE.
</div>
</xsl:otherwise>
...
3. Make AdSense SiteSearch-Code Template Friendly
The entity in the SiteSearch-Code (see section 1. above) cannot be processed by Forrest. It has to be replaced by a simple space character.
4. Adjust Height of Search Box Block
The search box is surrounded by a <div class="searchbox"> tag. The standard height of this block is not large enough to include the Google SiteSearch box. In order to fit the SiteSearch box into the surroundig <div> it's height has be increased in the CSS class searchbox. This is done by adding the following line to {PROJECT_HOME}\src\documentation\skinconf.xml:
...
#top .searchbox { height: 74px; }
...

