DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:googlesearch

Google Search

Compatible with DokuWiki

No compatibility info given!

plugin This plugin allows you to embed the Google Search API in the Wiki.

Last updated on
2006-07-17
Provides
Action

This extension has not been updated in over 2 years. It may no longer be maintained or supported and may have compatibility issues.

Tagged with !obsolete, embed, google, search

:!: Google no longer issues new API keys, because their SOAP API is no longer supported by them. Users without an API key do not need to download this plugin. Holders of an older API key should be aware that this plugin might cease to work when Google finally disables the SOAP API.

Install

Download and install the latest package

Add the search field to your template using the following syntax:

<?php action_plugin_googlesearch::searchform() ?>

Configuration

Either use the config manager or edit your local.php manually. The following config options are supported.

  • $conf['plugin']['googlesearch']['apikey']
  • $conf['plugin']['googlesearch']['maxresults']
    • Maximum number of results per page
    • Google allows a maximum of 10

Comments

Could we please supply plugins with a .zip extension? That way we can use the plugin manager to install these plugins regardless of what platform we are installing on. I use DokuWiki as an information repository on my Windows PC, which doesn't understand .tgz compression. Thanks, and keep up the great work! Jeff Childs, 08/31/06

The plugin manager should be able to extract both, ZIP and TGZ files, regardless of your platform. If it doesn't work for you submit a bug report. — Andreas Gohr 2006-10-01 19:00

For manual installation, I found that you need to edit the /lib/plugins/googlesearch/GoogleAPI.php file and change a line in the do_search() function. Line 40 should be changed to

          'key'        => 'abcdefghijklmnopqrstuvwxyz+/XYZ', 

where the letters between the quotes represent the API key that Google sends to you. Dan Feldman, 10/16/06

Failed to work on DokuWiki-rc2006-10-08. nusoap complains redeclare soapclient on line 7240. Terence, 10/17/06

nusoap might not be required in PHP5 which AFAIK comes with it's own soapclient. Removing the nusoap require line may work (untested). — Andreas Gohr 2007-03-24 19:28

Looks great. Is this working still with recent versions? Could the instructions be improved? “Add the search field to your template using the following syntax:” What template? /inc/template.php? Where in the template? I tried and it broke stuff with version 2006-11-06. Also the Google link above is out of date and redirects. Also do you have to pay money to get a key from Google? Thanks a lot.

It should work with recent versions, though I haven't tested it. You need to modifiy the main.php file of the template you use, e.g. lib/tpl/default/main.php. The API key is free, but IIRC Google recently announced not to give away any new keys because they deprecated the SOAP API. — Andreas Gohr 2007-03-24 19:28

Hi there - sorry if I'm being thick, but where should I enter this code? Specifically, whereabouts in the main.php file should I enter the <?php action_plugin_googlesearch::searchform() ?> line? Also - whereabouts in the local.php file should I enter the code $conf['plugin']['googlesearch']['apikey']

hi folks, i need some help with this …
i will write down my steps, so you can see where i have gone wrong
got myself a Google APIwent to the following link because i could not find what i was supposed to find on the “get Your Google API” in the above instructions. Google API
did not know which of 3 choices to choose,
so i chose the middle one and put in the URL of my DokuWiki.

uploaded the plugin into my plugin folder.
went to manage plugins.
google search is ticked …. great

added the following to main.php - too a wild guess - where to add the line - i do not know … add it anywhere
<?php action_plugin_googlesearch::searchform() ?>

>
i add either line to my local.php

$conf['plugin']['googlesearch']['apikey']
$conf['plugin']['googlesearch']['maxresults']


error message when i add either above line to my local.php

Parse error: syntax error, unexpected > T_VARIABLE /home/parents/public_html/xxxxx/conf/local.php on line 9

so i reuploaded the unmodified local.php
no more error message.
edited my googleAPI ie changed line 40 with the following

'key'        => 'abcdefghijklmnopqrstuvwxyz+/XYZ', 
still nothing
replace the above letters in between the parenthesis with my own key
still nothing
i add either line to my local.php
$conf['plugin']['googlesearch']['apikey']

>
I GET that same error message when I add line to my local.php
so I undo that line from my local.php

QUESTION
do you have any clues for me?
thank you for your time, alto

Add it to your header.php and add this to your local.php

$conf['plugin']['googlesearch']['apikey']**;**
$conf['plugin']['googlesearch']['maxresults']**;**
plugin/googlesearch.txt · Last modified: 2011-11-29 15:53 by C_hammer