3P Techies Forum
Log in
Register
What's new
Search
Search titles only
By:
Menu
3P Techies Forum
Log in
Register
What's new
Search
Search titles only
By:
Home
Forums
New posts
Search forums
Advanced search
What's new
New posts
Latest activity
Search titles only
By:
New posts
Search forums
Advanced search
Forums
Tech Support & Sciences
Ask the Tech Geeks
How to Easily replace the smf theme default search with google custom search
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="gurusmaker" data-source="post: 2127" data-attributes="member: 1"><p>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 <a href="http://custom.simplemachines.org/mods/index.php?mod=2201" target="_blank">here</a> same for removing help from menu you can just download the remove help from menu mod <a href="http://custom.simplemachines.org/mods/index.php?mod=2640" target="_blank">here</a>, except you wanna do some little customization yourself which is just as easy as installing new mod .</p><p></p><p>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</p><p>search for this [code]'help' => array(</p><p> 'title' => $txt['help'],</p><p> 'href' => $scripturl . '?action=help',</p><p> 'show' => true,</p><p> 'sub_buttons' => array(</p><p> ),</p><p> ),</p><p>[/code]</p><p>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 .</p><p></p><p>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 .</p><p></p><p>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.</p><p></p><p>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[code] <?php require("/home/*******/public_html/SSI.php"); </p><p>$context['page_title_html_safe'] = 'Results';</p><p>template_header(); </p><p>echo'</p><p></p><p></p><p></p><p></p><p><center><div id="cse-search-results"></div></p><p><script type="text/javascript"></p><p> var googleSearchIframeName = "cse-search-results";</p><p> var googleSearchFormName = "cse-search-box";</p><p> var googleSearchFrameWidth = 800;</p><p> var googleSearchDomain = "www.google.com";</p><p> var googleSearchPath = "/cse";</p><p></script></p><p><script type="text/javascript" src="http://www.google.com/afsonline/show_afs_search.js"></script></p><p></p><p></center></td></p><p> </tr></p><p> </tbody></p><p></table>';</p><p></p><p>template_footer(); ?>[/code] save and upload it to the root directory of your forum where you have ssi.php</p><p></p><p>n/b replace [code]home/*******/public_html/SSI.php[/code]with your full forum path </p><p></p><p>Now edit your current theme index.template.php and search for this [code] <div class="news normaltext"></p><p> <form id="search_form" style="margin: 0;" action="', $scripturl, '?action=search2" method="post" accept-charset="', $context['character_set'], '"></p><p> <input type="text" name="search" value="" class="input_text" /> </p><p> <input type="submit" name="submit" value="', $txt['search'], '" class="button_submit" /></p><p> <input type="hidden" name="advanced" value="0" />';[/code]and replace it with the code google provided you as in :[code]<div class="news normaltext"></p><p><form action="http://www.obasimvilla.com/forum/results.php" id="cse-search-box"></p><p> <div></p><p> <input type="hidden" name="cx" value="partner-pub-0022808160619558:cah4ko-n5ph" /></p><p> <input type="hidden" name="cof" value="FORID:10" /></p><p> <input type="hidden" name="ie" value="ISO-8859-1" /></p><p> <input type="text" name="q" size="31" /></p><p> </div></p><p></form></p><p><script type="text/javascript" src="http://www.google.com/cse/brand?form=cse-search-box&amp;lang=en"></script>';[/code]</p><p></p><p>save and reload your forum to check if every thing now works fine .</p><p></p><p>you may refer to a more pragmatic tutorial in the smf official site here [code]http://www.simplemachines.org/community/index.php?topic=366910.0[/code]if your smf version is different from the one in this tutorial</p></blockquote><p></p>
[QUOTE="gurusmaker, post: 2127, member: 1"] 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 [url=http://custom.simplemachines.org/mods/index.php?mod=2201]here[/url] same for removing help from menu you can just download the remove help from menu mod [url=http://custom.simplemachines.org/mods/index.php?mod=2640]here[/url], 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 [code]'help' => array( 'title' => $txt['help'], 'href' => $scripturl . '?action=help', 'show' => true, 'sub_buttons' => array( ), ), [/code] 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[code] <?php require("/home/*******/public_html/SSI.php"); $context['page_title_html_safe'] = 'Results'; template_header(); echo' <center><div id="cse-search-results"></div> <script type="text/javascript"> var googleSearchIframeName = "cse-search-results"; var googleSearchFormName = "cse-search-box"; var googleSearchFrameWidth = 800; var googleSearchDomain = "www.google.com"; var googleSearchPath = "/cse"; </script> <script type="text/javascript" src="http://www.google.com/afsonline/show_afs_search.js"></script> </center></td> </tr> </tbody> </table>'; template_footer(); ?>[/code] save and upload it to the root directory of your forum where you have ssi.php n/b replace [code]home/*******/public_html/SSI.php[/code]with your full forum path Now edit your current theme index.template.php and search for this [code] <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" />';[/code]and replace it with the code google provided you as in :[code]<div class="news normaltext"> <form action="http://www.obasimvilla.com/forum/results.php" id="cse-search-box"> <div> <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" /> </div> </form> <script type="text/javascript" src="http://www.google.com/cse/brand?form=cse-search-box&lang=en"></script>';[/code] 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 [code]http://www.simplemachines.org/community/index.php?topic=366910.0[/code]if your smf version is different from the one in this tutorial [/QUOTE]
Insert quotes…
Name
Verification
Post reply
Forums
Tech Support & Sciences
Ask the Tech Geeks
How to Easily replace the smf theme default search with google custom search
Menu
Log in
Register
Install the app
Install
Top