[Mediawiki-l] Switching between mediawiki and another search engine

Alistair Johnson JohnsonA at rembrandt.co.nz
Wed Mar 23 21:52:13 UTC 2005


Hi all,

I'm building a simplified MediaWiki skin for our Intranet and all is going
well apart from one thing.  We want to use the search box to either search
our MediaWiki instance or the Internet (via google).

I have this working under a straight HTML page without any worries, but when
I go to integrate it into the PHP code for our skin it doesn't work.  The
code I have is:

<script type="text/javascript" language="JavaScript">
<!--
function ActionDeterminator()
{
if(document.searchform.engine[0].checked == true) {
document.searchform.action = '<?php $this->text('searchaction') ?>';
}
if(document.searchform.engine[1].checked == true) {
document.searchform.action = 'http://www.google.com/search';
document.searchform.method = 'get';
document.searchform.q = document.searchform.search;
}
return true;
}
// -->
</script>

<form name="searchform" action="<?php $this->text('searchaction') ?>"
id="searchform">
 <input name="q" type="hidden" value="">
 <input type="radio" name="engine" checked>Intranet
 <input type="radio" name="engine">The web
 <input name="search" type="text"
  <?php if($this->haveMsg('accesskey-search')) { 
   ?>accesskey="<?php $this->msg('accesskey-search') ?>"<?php
   }
  if( isset( $this->data['search'] ) ) {
   ?> value="<?php $this->text('search') ?>"<?php } ?> />
 <input type='image' name="fulltext"
  class="searchButton" src="<?php $this->text('stylepath') ?>/<?php
$this->text('stylename') ?>/search.gif" alt="Search"
  value="<?php $this->msg('search') ?>" onClick="return
ActionDeterminator();" />
</form>

It's the line "document.searchform.q = document.searchform.search;" that
doesn't appear to being called when run under MediaWiki.  Is anyone able to
help me out and check this on their site to see if it's a problem with this
code?  If this code works fine elsewhere then it's a problem with the skin
which will be a bit harder to track down :-(

Hoping someone can help.

al.



More information about the MediaWiki-l mailing list