Block with web search option?

Block with web search option?

by Marc Dastous -
Number of replies: 7

Alright!!

I love the availability of the calendar on the Main page!  I do have one request and I have had this desire for a long time.  Instead of just a forum search, I need to have a "Google" or other search box available in my course.  I wish my students to have quick access to "outside" sources from within my Moodle installation.

I would think this could be a separate "block", but is there any way to have a "search this site/search the web" option?

Marc

Average of ratings: -
In reply to Marc Dastous

Re: Block with web search option?

by Tom Murdock -
If you create a label and paste this data in, you'll have a google search (safe from adult themed sites, apparently):

<!-- Google SafeSearch  -->
<center>
<FORM method=GET action="http://www.google.com/search">
<TABLE bgcolor="#FFFFFF"><tr><td>
<A HREF="http://www.google.com/search?safe=vss">
<IMG SRC=""
 border="0" ALT="Google" width="115" height="45" align="absmiddle"></A>
<INPUT TYPE=text name=q size=25 maxlength=255 value="">
<INPUT type=hidden name=safe value=vss>
<INPUT type=submit name=sa value="Google Search">
</td></tr></TABLE>
</FORM>
</center>
<!-- Google SafeSearch -->

This and other free "outside" Google searches are available here.
In reply to Tom Murdock

Re: Block with web search option?

by Jon Bolton -
Picture of Particularly helpful Moodlers Picture of Testers
Further to Tom's post, I've attempted to add the code to a new block (attached).

1. In your Blocks directory, create a folder called googlesearch
2. Unzip block_googlesearch.php to your blocks/googlesearch
3. Unzip block_google.php to your language directory
4. Go to yourmoodle/admin to install

In reply to Jon Bolton

Re: Block with web search option?

by Eloy Lafuente (stronk7) -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Peer reviewers Picture of Plugin developers Picture of Testers
Hi Jon,

Very cool block!! Thanks!!

Perhaps, the only comment (not really important) about your block is that the lang file should be called "block_googlesearch.php" (I know that, to store it in the zip, names must be different, but perhaps is better to include it in a lang directory).

Although for now it's really a silly thing, near in the future it could be mandatory to start some new developments in Moodle...

Ciao smile


In reply to Jon Bolton

Re: Block with web search option?

by Marc Dastous -

This worked AWESOME!!!!

How would I incorporate this with the new Main page code?  I was unable to get this block to appear on the Main page.

Thanks again, this will really help my students.  BTW, I even customized the code a little further by adding a site search option.  This is hard coded into line 79 of the block_googlesearch.php.

I've attached the code, maybe someone can add to it.

Marc

In reply to Marc Dastous

Re: Block with web search option?

by Gustav W Delius -

To be able to have the block on the site home page you need to add

    function applicable_formats() {
        return COURSE_FORMAT_WEEKS | COURSE_FORMAT_TOPICS | COURSE_FORMAT_SOCIAL | COURSE_FORMAT_SITE;
    }

If you don't have that function then the block is available on all courses EXCEPT the site.

In reply to Gustav W Delius

Re: Block with web search option?

by sonny boy -
Hi Gustav, to where shall I add this function...? smile