Extension talk:Google Custom Search Engine

From mediawiki.org
Jump to navigation Jump to search

Embedd Search??[edit]

Hello I've got a question. I included everything like you said. But if I want to set the Search Box with the code from google it just looks like this:

 <form id="searchbox_005336260029032773600:w-zt3d7kkog" action="http://my_hompage,_normaly_here_is_the_exact_hp_i_know">
   <input type="hidden" name="cx" value="005336260029032773600:w-zt3d7kkog" />
   <input type="hidden" name="cof" value="FORID:11" />
   <input name="q" type="text" size="40" />
   <input type="submit" name="sa" value="Search" />
   <img src="http://www.google.com/coop/images/google_custom_search_smwide.gif" alt="Google Custom Search" />

and if i delete the blank lines its the same, there is no Search box. Please can you help me? — Preceding unsigned comment added by (talkcontribs) 01:32, 8 August 2007

But there is a weird phenomen.. If I klick on my WikiEd (instant) preview, I see the Search box. The normal Preview doesn't show this. I cleared my browser cache etc. but it doesn't help -.- — Preceding unsigned comment added by (talkcontribs) 01:57, 8 August 2007

Searching returns to main page[edit]

I've followed the instructions provided, but searching using the google search box returns me to the main page of the wiki - not the search results page. No search results appear at all!

Any ideas? — Preceding unsigned comment added by (talkcontribs) 21:59, 19 September 2007

I have the same problem can somebody please help me?--Snapte 13:07, 4 February 2008 (UTC)

  • ok found the problem i forgot step:
    At the "code" section, you need expand "Search box and search results code for your website" and file one wiki page in your site which you want to display the search result (I recommend filling the URL like this http://yoursite.com/wiki/yourwikiname:GoogleSearch).

Thx -- 08:42, 6 February 2008 (UTC)


I cannot even begin to follow these instrctions....

Find the "code" section at "control panel". Neither of those things exist: http://www.google.com/coop/.

Exactly what are we talking about here? — Preceding unsigned comment added by (talkcontribs) 08:55, 9 November 2007

You are correct, the instructions are written poorly, but I at least got past that part. The real link is here, and you have to click the "Create a Custom Search Engine" button while logged into your Google account. -PatPeter, Tournesol.pngMediaWiki Support Team 02:39, 21 February 2008 (UTC)

No results[edit]

When i enter a search it goes to the page i specified but it does not display any search results.. Any one a idea what is wrong? Check http://wiki.covertpaintball.co.za

thx --Snapte 09:05, 6 February 2008 (UTC)

No results here, too[edit]

I tried to install this PlugIn, but i don't get any results, too. The Google engine works (see here: http://www.google.com/coop/cse?cx=005250012417280926508:3tkwec9tro8). Here's the wiki: http://www.uwe-kern.de/winfwiki/index.php/winfwiki:GoogleSearch And the URL of the Input Search Field: http://www.uwe-kern.de/googlesearch.html

I have no idea what the problem is, please help me...

Such an irony to know that many other wiki users able to use this extension but leave us alone here, especially the author.-- 10:19, 24 August 2008 (UTC)

This was happening to me as well. What finally fixed the issue was putting the entire google code into a single line of code. This is before the return $output line in google-coop.php.

Step-by-Step Required[edit]

As mentioned above, these instructions are far from clear and would benefit from an update, the succinct use of language, and the application of a step-by-step procedural structure. I would do the edit myself, but have no idea what is being referred to. It appears this has lead to a number of problems that have so far gone unanswered, which is unfortunate as the Custom Search Engine is such a valuable tool.

Additional Step[edit]

What I discovered was the way some hosting companies have PHP implemented, you have to remove all line breaks from the google-coop.php function renderGoogleCoop. The $ouptut line should basically be one very long line:

<form action="http://yourwiki.org/index.php/GoogleSearch" id="cse-search-box">
<input type="hidden" name="cx" value="yougooglekey" /><input type="hidden" name="cof" value="FORID:10" /><input type="hidden" name="ie" value="UTF-8" /><input type="text" name="q" size="31" /> <input type="submit" name="sa" value="Search" />
</form> <script type="text/javascript" src="http://www.google.com/coop/cse/brand?form=cse-search-box&lang=en"></script>
<script type="text/javascript"> var googleSearchIframeName = "cse-search-results"; var googleSearchFormName = "cse-search-box"; var googleSearchFrameWidth = "600"; var googleSearchDomain = "www.google.com"; var googleSearchPath = "/cse"; </script> <script type="text/javascript" src="http://www.google.com/afsonline/show_afs_search.js"></script>


This stepped fixed the issue on my wikis.

Sidebar implementation.[edit]

How do i add this to the Sidebar for the googlesearch, or even better just replace the SEARCH object(s) with the Google extension.

I was thinking of reaplacing the SEARCH reference but seems its deep coded into the wiki engine. How do i add the form design to the sidebar for viewing.

Where am i supposed to put this code below?:

<form action="http://sl3d.woodassoc.us/wiki" id="cse-search-box">

    <input type="hidden" name="cx" value="012893735686148946488:s7wc4m0qw74" />
<input type="hidden" name="cof" value="FORID:10" />
<input type="hidden" name="ie" value="UTF-8" />
<input type="text" name="q" size="31" />
<input type="submit" name="sa" value="Search" />

<script type="text/javascript" src="http://www.google.com/jsapi"></script>
<script type="text/javascript">google.load("elements", "1", {packages: "transliteration"});</script>
<script type="text/javascript" src="http://www.google.com/coop/cse/t13n?form=cse-search-box&t13n_langs=en"></script>
<script type="text/javascript" src="http://www.google.com/coop/cse/brand?form=cse-search-box&lang=en"></script>

is there something i am missing from the instructions?

Goldbishop 15:46, 29 June 2009 (UTC)
sl3d.woodassoc.us (site i am trying to implement this into)

Need help with the "Includes(extensions/google-coop.php"); to localsettings.php[edit]

I've got the php file uploaded to my extensions folder but I don't understand the second part of the sentence:

Upload the google-coop.php to your extensions/directory, and add include("extensions/google-coop.php"); to your LocalSettings.php file.

can someone help with that part? I know the localsettings.php but I am not sure what/where it goes in that file.



No results[edit]

always return to Main page, even though I edit $output in single line with no space.
What is the meaning of

Then use another code Google provided at the pages you want to be the entrance of the search.

BTW: I use mediawiki 1.15.0 and I just test my wiki in local server like http:\\localhost\wiki...
Could someone help me here? thanks!

I'm seeing the exact same problem. Agree with all of the comments above - this looks to be a very useful extension that is let down by its documentation. --Revells 12:07, 14 April 2010 (UTC)

MS Notepad[edit]

Should we really suggest that people copy the code into MS Notepad? Doesn't Notepad often mess up PHP scripts by adding byte order marks? Tisane 20:41, 16 April 2010 (UTC)

Try Google Gadgets widget Instead[edit]

We used the Google Gadgets widget successfully. You may want to try it, especially if you are having problems with this extensions. --LRG 17:01, 2 January 2011 (UTC)

Suggested Major Update[edit]


It looks like this extension has not been updated in a while, while Google Custom Search (CSE) has.

One update is more interesting than others, at least for me, because it provides potential for a major update of this extension:

Look and Feel: CSE provides code for embedding in 3 options, namely:

  • Search element. Provides the most layout and customization options.
  • Iframe. Provides limited customization and requires a separate page for results on your site.
  • Google-hosted page. Results are hosted on Google.

Taking away the "Google-hosted page" option, which involves users to be redirected out of Mediawiki for visualizing search results, there are two remaining options, both providing some level of customization.

This extension uses the Iframe option, which is the more limited. Still, CSE allows you to customize the look and feel of it, but such customizations are not taken into account by this extension, which only renders the search box and the search results in the default, essential, poor layout. This should be improved, for better usability and visual integration.

In the end, three suggestions:

  • Update the extension so that "Search element" code is supported. And/or at least
  • Fix code for Iframe option, so that customization is applied.
  • Add support for new Mediawiki Vector skin (search box is not in sidebar anymore)


Davide 09:24, 25 January 2011 (UTC)

Update suggestion[edit]

Is it possible to set this up so that it doesn't have to be a google custom search, in short can I use it to search the entire web with google? I like the way this extension integrates nicely with mediawiki and displays results "within" a mediawiki page and I want to use it in this manner to search the entire web.

Also, is it possible to write a hack so that if a user types a query into the mediawiki stock search field the same search is automatically inserted into the google field, and then when the user clicks "search" both search engines are sent the request?.

Similar to how this google extension works: Extension:GoogleSiteSearch Example: http://www.finnix.org/Special:Search?search=Debian&go=Go

I figure if these two things are possible, then I could use iframes to display internal mediawiki search results and entire web search results side-by-side.

Thanks05:15, 24 March 2011 (UTC)

add a mini-google search bar to wiki[edit]


 I have mini-google search appliance and I would like to add the google search box to my wiki (just below the wiki search box). How can do this?

iframe border[edit]

In case of using mediawiki skin kindofblue, an ugly frame boarder appears. To remove it, you can add the followinf css to skins/kindofblue/main.css :

iframe {
 border: 0px solid #ffffff;