News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

how to replace default smf search with google search ??

Started by desai_amogh, April 04, 2014, 10:19:19 AM

Previous topic - Next topic

desai_amogh

Hi, i need to replace the default SMF search with google search,

how do i do this ??


desai_amogh

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 !

margarett

Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

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

Illori

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

desai_amogh

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.


Colin

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

desai_amogh

While a mod is being worked upon, IS it possible i can make any changes to the template to achieve this ??

Colin

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

desai_amogh

im using the curve theme, and I need to embed the below search box instead of the default one.  Where to put this code ??

<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>

swaggaderby


Kindred

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)
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

webewitch

#12
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:

<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:
<div class="news normaltext">

';


..and above the ';

insert your google search code :

<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) ?

Kindred

Did you even bother to look at the mod that I linked or check out the ADK site for their version?
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

webewitch

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.


Advertisement: