Extension:SearchBox

From MediaWiki.org
Jump to: navigation, search
MediaWiki extensions manual - list
Crystal Clear action run.png
SearchBox

Release status: beta

Implementation Tag
Description Allow inclusion of search forms
Author(s) Trevor Parscaltalk
Latest version SVN (2008-10-28)
MediaWiki 1.8 and higher
License GPL v2
Download Template:WikimediaDownload/svn
Hooks used
ParserFirstCallInit

Translate the SearchBox extension if possible

Check usage and version matrix; code metrics

This tag extension provides a way to add a search box to a page. This extension is intended to provide more functionality for people who are currently using the InputBox extension as a search box.

User Interface[edit | edit source]

Adding a SearchBox[edit | edit source]

To add a SearchBox to a page, place a <searchbox /> tag to the page. Using XML style attributes, you can configure the SearchBox using many parameters

Installation[edit | edit source]

  • Copy the SearchBox folder into your extensions directory.
  • Add the line require_once "{$IP}/extensions/SearchBox/SearchBox.php"; to LocalSettings.php.
    <translate>

[[<tvar|man-ip>Special:MyLanguage/Manual:$IP</>|$IP]] stands for the Installation Path (or "directory") of your MediaWiki installation, the same directory that holds [[<tvar|LocalSettings>Special:MyLanguage/Manual:LocalSettings.php</>|LocalSettings.php]], [[<tvar|index>Special:MyLanguage/Manual:index.php</>|index.php]] etc..</translate>

  • Add a <searchbox /> tag to any page you wish to use the extension on.

Parameters[edit | edit source]

This extension is configurable using XML style attributes, like so...

<searchbox
    label="Search this wiki for:"
    searchlabel="Find it..."
    golabel="Go!"
/>

The following parameters may be set to customize your search box.

Label[edit | edit source]

Inserted before the text input box. This parameter is passed through the wiki text parser.

* default: 
* format:       string
* example:      'Search this wiki for:'

SearchLabel[edit | edit source]

Applied as the value of the search button

* default: internationalized message
* format:       string
* example:      'Find It!'

GoLabel[edit | edit source]

Applied as the value of the go button

* default: internationalized message
* format:       string
* example:      'Go!'

Hide[edit | edit source]

A list of elements to hide

* default: 
* format:       List of comma delimited names: input | go | search | namespaces
* example:      'go'

NamespacesLabel[edit | edit source]

Inserted before the list of namespace checkboxes

* default: internationalized message
* format:       string
* example:      'Namespaces to search:'

Namespaces[edit | edit source]

If there is more than 1 valid namespace in this list, a list of checkboxes will be inserted after the text input box and before the search button, in place of the go button. This parameter is passed through the wiki text parser.

* default: 
* format:       List of comma delimited names, items with ** in them are check by default
* example:      '**Main,Special,User**'

Align[edit | edit source]

Applied to the entire box

* default: 'center'
* format:       'left' | 'center' | 'right'
* example:      'left'

Style[edit | edit source]

CSS applied to the entire box

* default: 
* format:       inline CSS
* example:      'border:1px solid red;'

Default[edit | edit source]

Applied as the value of the text input box

* default: 
* format:       string
* example:      'something in particular'

Size[edit | edit source]

Applied as the width (in characters) of the text input box

* default: 50
* format:       integer
* example:      20

Width[edit | edit source]

Applied as the width (in pixels) of the text input box

* default: 'auto'
* format:       integer | 'auto'
* example:      25

Spacing[edit | edit source]

Applied to all controls in the box as amount of space (in pixels) between them

* default: 5
* format:       integer
* example:      10