[Mediawiki-l] Question: how-to embed a different search engin e?
Alistair Johnson
JohnsonA at rembrandt.co.nz
Thu Apr 7 20:29:29 UTC 2005
From: David Gerisch [mailto:DEGerisch at co.tulare.ca.us]
[snip]
> just replace the search portlet with an anchor link to the htDig
> search page.
What I did was to edit \skin\skinname.php (where skinname is the skin you
are using - I took monobook & derived a new skin from it to hold all our
customisations).
The code we now have for the search portlet 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.co.nz/search';
document.searchform.method = 'get';
document.searchform.q.value = document.searchform.search.value;
}
return true;
}
function entsub(myform) {
if (window.event && window.event.keyCode == 13) {
ActionDeterminator();
myform.submit();
} else {
return true;
}
}
// -->
</script>
<tr>
<td align="right" nowrap>
<div class="searchtext">
<form name="searchform" action="<?php $this->text('searchaction')
?>" id="searchform">
<input name="q" type="hidden" value="">
<input type="radio" name="engine" checked><font
color="white">Intranet</font>
<input type="radio" name="engine"><font color="white">The web</font>
<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 } ?>
onkeypress="return entsub(this.form)"/>
<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>
</div> <!-- searchtext -->
</td>
</tr>
Which allows us to choose between a google search & a wiki search.
Hope this helps.
al.
More information about the MediaWiki-l
mailing list