Help:Google RU

From Apache OpenOffice Wiki
Revision as of 07:47, 18 November 2010 by Ccornell (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

The Google search extension in use on the Wiki is a mix and a modification of two MediaWiki extensions:

The RU modification uses the google-coop.php from the Google search extension already installed on the Wiki (no modifications or changes to this file).

The Google_RUhp"> <?php

  1. To activate the extension, include it from your LocalSettings.php
  2. with: include("extensions/Google_RU.php");
  3. Syntax:

$wgExtensionFunctions[] = "wRUGoogle";

function wRUGoogle() {

   global $wgParser;
   $wgParser->setHook( "googleRU", "renderGoogleRU" );


  1. The callback function for converting the input text to HTML output

function renderGoogleRU( $input ) {

   $output = ;
   $output .= '<form action=""cse-search-results">';
$output .= '
   $output .= '<input type="hidden" name="cx" value="012451685560999373550:mwuatqsviug" />';
   $output .= '<input type="hidden" name="cof" value="FORID:9" />';
   $output .= '<input type="text" name="q" size="25" />';
   $output .= '<input type="submit" name="sa" value="Search" />';
$output .= '
   $output .= '</form>';
   $output .= '<script type="text/javascript" src=""></script>';
   $output .= ;
   return $output;


</source> This file defines the actual search, with the most critical part being <tt>value="012451685560999373550:mwuatqsviug" which is the code Google uses to identify the specific custom search (see It has been modified from what is documented on the original extension website. The $output section has been replaced with the code from a Google Custom search that is defined to search only in the /Documentation/FAQ Wiki subpages.

In the LocalSettings.php file, you must add:


to enable the extension.

Personal tools