Advertisement:

Author Topic: how to replace default smf search with google search ??  (Read 5453 times)

Offline desai_amogh

  • Semi-Newbie
  • *
  • Posts: 35
    • Electronics Forum India
how to replace default smf search with google search ??
« on: April 04, 2014, 10:19:19 AM »
Hi, i need to replace the default SMF search with google search,

how do i do this ??

Offline Matthew K.

  • SMF Super Hero
  • *******
  • Posts: 12,430
  • Gender: Male
    • matthew.kerle on Facebook
    • @matthew_kerle on Twitter
Re: how to replace default smf search with google search ??
« Reply #1 on: April 04, 2014, 10:25:15 AM »

Offline desai_amogh

  • Semi-Newbie
  • *
  • Posts: 35
    • Electronics Forum India
Re: how to replace default smf search with google search ??
« Reply #2 on: April 04, 2014, 11:16:52 AM »
there is none which works with 2.0.7, so i feel im better of editing the template..

can someone help me with editing the template to get google (adsense code) search to replace the default search ??

thanks !

Offline margarett

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 19,761
  • Gender: Male
Re: how to replace default smf search with google search ??
« Reply #3 on: April 04, 2014, 11:38:50 AM »
There is actually just 1 MOD that can do that:
http://custom.simplemachines.org/mods/index.php?mod=2566

Not sure if this is what you want...
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

Quote
Over 90% of all computer problems can be traced back to the interface between the keyboard and the chair

Offline Illori

  • Project Manager
  • SMF Legend
  • *
  • Posts: 50,965
Re: how to replace default smf search with google search ??
« Reply #4 on: April 04, 2014, 11:45:33 AM »
this one should do it as well http://custom.simplemachines.org/mods/index.php?mod=1634 and it adds a few other features. but it does not disable the default search page

Offline desai_amogh

  • Semi-Newbie
  • *
  • Posts: 35
    • Electronics Forum India
Re: how to replace default smf search with google search ??
« Reply #5 on: April 07, 2014, 01:50:32 AM »
These are good mods if one wants just google search enabled for their forum.

But not good for my purpose.  What I want is, to replace the default search completely by google custom search (AdSense for search) code.


Offline Colin

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 7,873
  • Gender: Male
  • SMF Developer
    • colinschoen on GitHub
Re: how to replace default smf search with google search ??
« Reply #6 on: April 07, 2014, 02:44:22 AM »
If it isn't available with the mods currently on the mod site then you can submit a mod request here: http://www.simplemachines.org/community/index.php?board=79.0
"If everybody is thinking alike, then somebody is not thinking." - Gen. George S. Patton Jr.

Colin

Offline desai_amogh

  • Semi-Newbie
  • *
  • Posts: 35
    • Electronics Forum India
Re: how to replace default smf search with google search ??
« Reply #7 on: April 07, 2014, 02:47:07 AM »
While a mod is being worked upon, IS it possible i can make any changes to the template to achieve this ??

Offline Colin

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 7,873
  • Gender: Male
  • SMF Developer
    • colinschoen on GitHub
Re: how to replace default smf search with google search ??
« Reply #8 on: April 07, 2014, 03:07:26 AM »
Sure you can manually modify the index.template.php file if you wish.
"If everybody is thinking alike, then somebody is not thinking." - Gen. George S. Patton Jr.

Colin

Offline desai_amogh

  • Semi-Newbie
  • *
  • Posts: 35
    • Electronics Forum India
Re: how to replace default smf search with google search ??
« Reply #9 on: April 07, 2014, 03:55:18 AM »
im using the curve theme, and I need to embed the below search box instead of the default one.  Where to put this code ??

Code: [Select]
<form action="http://www.google.co.in" id="cse-search-box" target="_blank">
  <div>
    <input type="hidden" name="cx" value="partner-pub-xxxxxxxxxxxxx:xxxxxxxxxxxxxx" />
    <input type="hidden" name="ie" value="UTF-8" />
    <input type="text" name="q" size="55" />
    <input type="submit" name="sa" value="Search" />
  </div>
</form>

<script type="text/javascript" src="http://www.google.co.in/coop/cse/brand?form=cse-search-box&amp;lang=en"></script>

Offline swaggaderby

  • Jr. Member
  • **
  • Posts: 129
Re: how to replace default smf search with google search ??
« Reply #10 on: October 20, 2014, 02:49:20 PM »
Am in this situation too any way out?

Offline Kindred

  • The Mean One
  • Support Specialist
  • SMF Legend
  • *
  • Posts: 58,317
  • Gender: Male
    • Kindred-999 on GitHub
Re: how to replace default smf search with google search ??
« Reply #11 on: October 20, 2014, 04:06:19 PM »
http://custom.simplemachines.org/mods/index.php?mod=2566

also ADK had a mod that did google search as well (However, they took all their mods off our site and went to their own site a little while ago)
Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

Offline webewitch

  • Semi-Newbie
  • *
  • Posts: 40
    • Fuerteventura Forum
Re: how to replace default smf search with google search ??
« Reply #12 on: October 31, 2014, 09:01:34 AM »
I've just done it.

My coding may not be 'proper' but it works. (Feel free to correct it someone please!)

In Themes/default/index.template.php

about line 274

find this bit:

Code: [Select]
<div class="news normaltext">
<form id="search_form" action="', $scripturl, '?action=search2" method="post" accept-charset="', $context['character_set'], '">
<input type="text" name="search" value="" class="input_text" />&nbsp;
<input type="submit" name="submit" value="', $txt['search'], '" class="button_submit" />
<input type="hidden" name="advanced" value="0" />';

// Search within current topic?
if (!empty($context['current_topic']))
echo '
<input type="hidden" name="topic" value="', $context['current_topic'], '" />';
// If we're on a certain board, limit it to this board ;).
elseif (!empty($context['current_board']))
echo '
<input type="hidden" name="brd[', $context['current_board'], ']" value="', $context['current_board'], '" />';

echo '</form>';

replace with:
Code: [Select]
<div class="news normaltext">

';

..and above the ';

insert your google search code :

Code: [Select]
<div class="news normaltext">
<form action="http://www.google.co.uk" id="cse-search-box" target="_blank">
  <div>
    <input type="hidden" name="cx" value="partner-pub-xxxxxxxx:xxxxxxxxx" />
    <input type="hidden" name="ie" value="UTF-8" />
    <input type="text" name="q" size="55" />
    <input type="submit" name="sa" value="Search" />
  </div>
</form>

<script type="text/javascript" src="http://www.google.co.uk/coop/cse/brand?form=cse-search-box&amp;lang=en"></script>
';

It works for me :
http://www.fuerteventura-forum.com/index.php

I couldn't figure out how to have the results page integrated into my site so I elected for the results on a Google page.

Does anyone know how to implement the integration (one thing deterring me was that the minimum results iframe is 795px - far too wide for my 3 column layout) ?
« Last Edit: October 31, 2014, 09:14:00 AM by webewitch »

Offline Kindred

  • The Mean One
  • Support Specialist
  • SMF Legend
  • *
  • Posts: 58,317
  • Gender: Male
    • Kindred-999 on GitHub
Re: how to replace default smf search with google search ??
« Reply #13 on: October 31, 2014, 09:56:33 AM »
Did you even bother to look at the mod that I linked or check out the ADK site for their version?
Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

Offline webewitch

  • Semi-Newbie
  • *
  • Posts: 40
    • Fuerteventura Forum
Re: how to replace default smf search with google search ??
« Reply #14 on: November 05, 2014, 09:47:17 AM »
If you mean me - yes, I looked at the mod but from what I gathered it gives you the option to include Goggle or Yahoo searches.

What I wanted - and did - was to have my own Google Adsense Search - which is different to the standard Google Search - it earns me a little.

I had a quick search for the ADK thing but couldn't find it. I wasn't too bothered as I had already managed.