Thursday, August 16, 2007, 09:40 PM
Posted by Administrator
Posted by Administrator
Adding Google Search to my page was a relatively painless process. The worst part is adding the necessary quotes and line feeds to the code that Google provides you.To add Google Search to the already existing Search box, I had to once again modify the Simple PHP Blog file,
scripts/sb_theme.php. Once in the file, I needed to locate the menu_search_field function, which is the piece of PHP code that results in the Search box being displayed on the Blogging $100 a Day page.After the line:
$str .= '</form>';I had to insert the following code:
$str .= '<hr>';
$str .= '<!-- Search Google -->' . "\n";
$str .= ' <center>' . "\n";
$str .= ' <form method="get" action="http://www.google.com/custom" target="google_window">' . "\n";
$str .= ' <table bgcolor="#' . $user_colors[ menu_bg ] . '">' . "\n";
$str .= ' <tr><td nowrap="nowrap" valign="top" align="left" height="32">' . "\n";
$str .= ' <a href="http://www.google.com/">' . "\n";
$str .= ' <img src="http://www.google.com/logos/Logo_25gry.gif" border="0" alt="Google" align="middle"></img></a>' . "\n";
$str .= ' <br/>' . "\n";
$str .= ' <label for="sbi" style="display: none">Enter your search terms</label>' . "\n";
$str .= ' <input type="text" name="q" size="11" maxlength="255" value="" id="sbi"></input>' . "\n";
$str .= ' <label for="sbb" style="display: none">Submit search form</label>' . "\n";
$str .= ' <input type="submit" name="sa" value="Search" id="sbb"></input>' . "\n";
$str .= ' <input type="hidden" name="client" value="pub-xxxxxxxxxxxxxxxx"></input>' . "\n";
$str .= ' <input type="hidden" name="forid" value="1"></input>' . "\n";
$str .= ' <input type="hidden" name="ie" value="ISO-8859-1"></input>' . "\n";
$str .= ' <input type="hidden" name="oe" value="ISO-8859-1"></input>' . "\n";
$str .= ' <input type="hidden" name="cof" value="GALT:#008000;GL:1;DIV:#336699;VLC:663399;AH:center;BGC:FFFFFF;LBGC:336699;ALC:0000FF;LC:0000FF;T:000000;GFNT:0000FF;GIMP:0000FF;LH:50;LW:375;FORID:1"></input>' . "\n";
$str .= ' <input type="hidden" name="hl" value="en"></input>' . "\n";
$str .= ' </td></tr></table>' . "\n";
$str .= ' </form>' . "\n";
$str .= ' </center>' . "\n";
$str .= '<!-- Search Google -->' . "\n";
That did the trick. Don't forget to use your own pub number!




( 3 / 26 )

Archives


