I want to be able to use google custom search on my smf site running on smf 2.0.3 "white box" theme as well as remove the "search" and "help" button close to Home on the navigation tab .
I have already registered on google already
Using google custom search /adsense shouldn't be a headache for newbies as there is already a mod for this all you need do is download the mod from here
same for removing help from menu you can just download the remove help from menu mod here
, except you wanna do some little customization yourself which is just as easy as installing new mod .
Now to manually remove help and search from smf navigation tab so as to display only your google custom search all you need do is => log in to cpanel /your forum / sources /subs.php and
search for this
'help' => array(
'title' => $txt['help'],
'href' => $scripturl . '?action=help',
'show' => true,
'sub_buttons' => array(
above or below it you will see search just change the true to false in both of them to have them hidden or mark them off to delete them completely .
Now to Replace your theme default search bar on smf 2.0.3 with google custom search all you need do is take note of the width in your theme css so as to know the options to configure in your custom search button options .
Now first step is to open your notepad and save it as results.php then go to your google adsense account and click on search (adsense for search) from "my ads" tab then from there create a new search custom search engine , give it a name and choose only Sites I select =>> Inside the list of sites enter your forum url starting with http://=>>on search box style remember to choose the width equal to the size of your forum search or edit your forum theme css to equal that of the width size you 've chosen ==>on search result choose "on my site using an iframe" then enter your forumurl/results.php under where search results will be displayed with width that will fit your forum theme (maybe 790).==> save and get code.
From the two code provided locate the one for result and paste it in the results.php you 've already created with your notepad or simply select and paste this
$context['page_title_html_safe'] = 'Results';
var googleSearchIframeName = "cse-search-results";
var googleSearchFormName = "cse-search-box";
var googleSearchFrameWidth = 800;
var googleSearchDomain = "www.google.com";
var googleSearchPath = "/cse";
save and upload it to the root directory of your forum where you have ssi.php
with your full forum path
Now edit your current theme index.template.php and search for this
<div class="news normaltext">
<form id="search_form" style="margin: 0;" action="', $scripturl, '?action=search2" method="post" accept-charset="', $context['character_set'], '">
<input type="text" name="search" value="" class="input_text" />
<input type="submit" name="submit" value="', $txt['search'], '" class="button_submit" />
<input type="hidden" name="advanced" value="0" />';
and replace it with the code google provided you as in :
<div class="news normaltext">
<form action="http://www.obasimvilla.com/forum/results.php" id="cse-search-box">
<input type="hidden" name="cx" value="partner-pub-0022808160619558:cah4ko-n5ph" />
<input type="hidden" name="cof" value="FORID:10" />
<input type="hidden" name="ie" value="ISO-8859-1" />
<input type="text" name="q" size="31" />
save and reload your forum to check if every thing now works fine .
you may refer to a more pragmatic tutorial in the smf official site here
if your smf version is different from the one in this tutorial