Google Search Block

Google Search Block

by James Phillips -
Number of replies: 14
How do you install the google search block? I found the block_google.php file in the forums and tried to just paste it into an html block but all I got was a box full of code on my frontpage. 
Average of ratings: -
In reply to James Phillips

Re: Google Search Block

by Jon Bolton -
Picture of Particularly helpful Moodlers Picture of Testers
James, what version of Moodle are you using? If you're using 1.5 and above, the easiest and quickest way for you to have Google Search functionality on your site is for you to get the Google Search Code from http://www.google.com/searchcode.html and simply paste that to an html block.

I'm not sure if the Google Search Block has been updated for 1.5 (the base code for all blocks changed substantially between 1.4 and 1.5!).
In reply to Jon Bolton

Re: Google Search Block

by James Phillips -
Jon! Thanks for the suggestion. I tried this also and still got just a box full of code displayed on my page. I am using 1.5.2. I feel like I must be doing something really basic wrong. I had the same problem a long time ago (with 1.3 or 1.4? I can't remember) and never managed to fix it. 
In reply to James Phillips

Re: Google Search Block

by Jon Bolton -
Picture of Particularly helpful Moodlers Picture of Testers
James, are you using the HTML editor? If you ARE, and if you are pasting the code straight into that, you will only see the code. You need to toggle the Editor into text mode. There is a button on the Editor toolbar that looks like <>

Delete the coded text that is currently in the box, toggle into text mode, and paste in the code again. Toggle back, and you SHOULD be able to see the Google logo and Search Box.

I've put a screen dump of my Google Search Box in the attached document for ease of reference.
In reply to Jon Bolton

Re: Google Search Block

by James Phillips -
Thanks Jon! It is all now appearing as it should. It doesn't seem to be searching properly, but I think that might be related to how I have my site set up encoding wise (UTF8 is switched on in config php, but not in the en language pack. It's a long story!). Thank you very much for the help!
In reply to James Phillips

Re: Google Search Block

by Jon Bolton -
Picture of Particularly helpful Moodlers Picture of Testers
Oh, an alarm bell's just started ringing!

The link to Google Search Code that I posted above will enable visitors to your site to search the WWW via Google - it won't search your site. Consequently, your site encoding wont affect the search.

If you want Google to search your site, there are a number of steps to take...

1. In your Admin pages, allow Google to enter the site.
2. Get the code from http://services.google.com/searchcode2.html?accept=on#both and paste it into your HTML block.
3. Have a browse through some of the help pages at http://www.google.com/support

In reply to Jon Bolton

Re: Google Search Block

by James Phillips -
No need for alarm bells! That was the code I was using! I will have a look through the support pages. Thanks again!
In reply to Jon Bolton

Re: Google Search Block

by Paul Stuart -
Hi Jon
I've just created the recommended HTML page, but a search of my site is always empty. Can you tell me, is this because I need to wait for Google's spiders to find my site (now that I've let Google in)? I'm using 1.7, so is this perhaps also an issue?

In reply to Paul Stuart

Re: Google Search Block

by Zachary Lyons -

You do have to wait for the spiders. Sometimes they can take a long time (3-4 weeks) to crawl your site.

Cheers,
Zachary

In reply to Jon Bolton

Re: Google Search Block

by Devon Jennings -
Hi. I have a site created on Moodle. There are multiple Wikis on there. I tried using the code from Google search. I need to be able to search those wikis with one parent search box on the main page. How do I do this?
In reply to Jon Bolton

Svar: Re: Google Search Block

by Anders Berggren -
Jon, I followed your instructions and the
solution works witout flaws in Moodle 1.5.2.
In reply to Anders Berggren

Re: Svar: Re: Google Search Block

by jon s -
Is there any plugin or module for google search?
In reply to jon s

Re: Svar: Re: Google Search Block

by Zachary Lyons -

There is, but as Jon said,

Begin Quote: the easiest and quickest way for you to have Google Search functionality on your site is for you to get the Google Search Code from http://www.google.com/searchcode.html and simply paste that to an html block.

Pretty simple, isn't it? Works like a charm.

Good Luck,
Zachary

In reply to Zachary Lyons

Re: Svar: Re: Google Search Block

by Mike Green -

http://www.google.com/searchcode.html  doesn't take you to the search code any more. This does, though, and it's simple enough to edit it to suit your preferred regional flavour of google: http://www.google.co.uk/searchcode.html

Incidentally, I spent a frustrating 20 minutes trying and failing to make this work in a label in the Main Menu block on my moodle front page. So don't try that. Put it into its own HTML block and it works fine.

In reply to Mike Green

Re: Svar: Re: Google Search Block

by Nichole Bahrt -

My colleagues and I have been having problems getting a Google Search Box into a block.  It works okay the first time we view it, but if we go back into the block to edit anything, the value tag for the submit bar (that says 'Google Search') disappears and the words 'Submit Query' show up instead.

Does anyone have any ideas???