Add Google Search on top of search page ?

Started by spikeweb, June 22, 2015, 07:23:25 AM

Previous topic - Next topic

spikeweb

Hi all,
Working on a main 1.x to 2.X upgrade, I need to include in the new release of my forum a Google Search like I did previously for 1.x.
The idea is to add a Google search input box on top of the original forum search (see screenshot).

I was using a mod called "Google Search Your Site".
Looks like it is not supported anymore and not reliable on 2.x.

Any other solution will be appreciated ! :)

Kindred

http://custom.simplemachines.org/mods/index.php?mod=2566


ironically, you could have found this by typing "Google search" into the mod site search bar....  :P
Сл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."

☠ DeadMan ☠

Also, if Google for "Add Google search to website" you'll find Google has their own little widget you can add.

Kindred

which does involve coding something instead of using a packaged mod.
Сл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."

☠ DeadMan ☠

Wow... Usually one line, and if using a portal, can be added into a block.
Did you even check to see if the mod installs into 2.0.10 without having to go in and manually install it?
I rather doubt it, as I would not have, either. ;)

Kindred

actually... I did (because I use it on another site) -- and it does.
Сл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."

☠ DeadMan ☠

Ahhh... Okay. :)
Can it be configured, to add Yahoo and other search engines?

Kindred

further questions on the mod really do belong in the mod thread...
Сл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."

spikeweb

Thanks for your answers.
Believe it or not but I spent a couple of hours looking for a solution, testing the old mod and browsing the forum before posting. So I will investigate this new possibility to sue Google widget.
I do like mods when they are updated, but this one seems to be out of support and I do not want to launch my new forum with outdated mods.

BTW, we did multiple tests on existing forum (1.x) and the new one (2.x dev) with the integrated search. It is really unreliable and a lot of members are complaining about the results. It is maybe due to our french language but I need to find an alternative.

☠ DeadMan ☠

Well, Kindred says he uses the mod he posted, so if it's good enough for him, I'm sure it's updated enough.

However, Google does have a way to set up a search your site, search widget, besides adding a search all over one.


☠ DeadMan ☠

Yes, another good one. I've used it before, too, very nice. :)
Been so long, I'd forgotten about it. Nice find, Illori. :)

spikeweb

Except that I have not this dropdown box in my theme ...
Still trying to add a search box in the search page, should'nt be that hard to add a few lines of code but I do not understand how and where to paste the Google code.
I am trying to duplicate the code which gives the original search box, and paste in the Google code but no way

<script>
  (function() {
    var cx = '009412665304303979485:gmdakijy7io';
    var gcse = document.createElement('script');
    gcse.type = 'text/javascript';
    gcse.async = true;
    gcse.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') +
        '//cse.google.com/cse.js?cx=' + cx;
    var s = document.getElementsByTagName('script')[0];
    s.parentNode.insertBefore(gcse, s);
  })();
</script>
<gcse:search></gcse:search>


spikeweb

One more step ...

I was able to install googlesearchyoursite mod onto 2.x
Then I get the new box at the bottom of the home page (see screenshot).

I still need now to add the same search box in the search page ... any idea ?
Copying and pasting the boardindextemplate.php code in the search page does not work

spikeweb

The exact problem is that the form is correctly displayed when added in the searchpage but when typing in a search, it does not provide the content to Google so I get an error in this same page ...
Same code is working fine on the boardindex page.

What am I missing ??

Illori

if you really dont want to use the default SMF search, remove the permissions to use it and force the users to use the other one.

spikeweb

This does not solve the Google CSE integration - I can use both, this is what I do with SMF 1.x but in 2.X I cannot found how to add this Google search field ... :)

Kindred

nothing built for 1.1.x will work correctly on 2.0.x without some major redesign. The templates are completely different, much of the data was abstracted and several of the function calls are different.

That's why we pointed you at two EXISTING mods that work fine with 2.0.x
Сл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."

Shambles

I have incorporated a Google CSE above the search function:

Curve Theme


Blackbox theme


You just need to get the code from the Google CSE page and paste it into the right place in Search.template.php

I actually use the V1 CSE code which gives more control over the css, but the basic code that google provides will work ok.

spikeweb

Thanks Shamble

I did what you describes, copying the Google code in searchtemplate.php, did some design using the existing classes and div and it works finally !

I prefer not to use the mods are they are not supported anymore for a long time.

gorbi

You can give an example of the code? Where to insert it?

Advertisement: