Help:Inputbox

From Phonology

Template:H:h The inputbox extension is a MediaWiki extension by Erik Möller to add predefined HTML forms to wiki pages. It was originally created for the purpose of adding a Create an article box to Wikinews. It requires MediaWiki 1.5 and an extensions script (see Installation below).

Contents

[edit] General syntax

Inputboxes are constructed like this:

 <inputbox>
 type=box type
 parameter1=value
 parameter2=value
 </inputbox>

The type parameter is mandatory. All other parameters are optional.

[edit] Box types

Type Example
type=search

<inputbox> type=search </inputbox>

Generates a search box with a default width of 50 characters. The button labels can be specified, see below; defaults MediaWiki:Tryexact and MediaWiki:Searchfulltext. The text field specifies the search criteria.
type=create

<inputbox> type=create </inputbox>

Allows creating a new page. The button label can be specified, see below; default MediaWiki:Createarticle. The text field specifies which page is to be edited.
type=comment

<inputbox> type=comment </inputbox>

Add one or more sections to an existing page, or create a page, with an edit summary that is automatically the same as the (first) new section header. The button label can be specified, see below; default MediaWiki:Postcomment also used in the sidebar of the "Standard" skin. The text field specifies which page is to be edited.

[edit] Parameters

Parameter
Scope
Description Example

<font id="par_bgcolor" />bgcolor=
All types

Sets the table background color (HTML color values). Do not use quotes.
<inputbox>
type=search
bgcolor=#eeeeff
</inputbox>

produces:

<inputbox> type=search bgcolor=#eeeeff </inputbox>

<font id="par_width" />width=
All types

Sets the width of the inputbox in characters, required for old browsers (see above).
<inputbox>
type=create
width=6
</inputbox>

produces:

<inputbox> type=create width=6 </inputbox>

<font id="par_default" />default=
All types

Default text to put in the inputbox.
<inputbox>
type=comment
default=User talk:Eloquence
</inputbox>

produces:

<inputbox> type=comment default=User talk:Eloquence </inputbox>

<font id="par_preload" />preload=

comment, create

The text of the page under this title will be loaded into the blank editbox when a new page is created. Enter the title of a non-existent page in the example inputbox, and click "Create" to test this effect.
<inputbox>
type=create
width=20
preload=MediaWiki:Editthispage
</inputbox>

produces:

<inputbox> type=create width=20 preload=MediaWiki:Editthispage </inputbox>

<font id="par_editintro" />editintro=
comment, create
The text of the page under this title will be added, as instructions, before the submission form for new pages. Enter the title of a non-existent page in the example inputbox, and click "Create" to test this effect.
<inputbox>
type=comment
width=20
editintro=MediaWiki:Missingcommenttext
</inputbox>

produces:

<inputbox> type=comment width=20 editintro=Mediawiki:Missingcommenttext </inputbox>

<font id="par_buttonlabel" />buttonlabel=
All types
This label will be used for the main button of the form.
<inputbox>
type=comment
buttonlabel=Add new rumor
</inputbox>

produces:

<inputbox> type=comment buttonlabel=Add new rumor </inputbox>

<font id="par_searchbuttonlabel" />searchbuttonlabel=
search
This label will be used for the "Search full text" button of the search form.
<inputbox>
type=search
searchbuttonlabel=Dig deeper
</inputbox>

produces:

<inputbox> type=search searchbuttonlabel=Dig deeper </inputbox>

<font id="par_break" />break=
yes
Whether or not to insert a line break between the input box and the button(s). Defaults to using the line break unless set to no.
<inputbox>
type=create
break=no
</inputbox>

produces:

<inputbox> type=create break=no </inputbox>

Applying create  to an existing page simply gives the edit page. In that case editintro and preload are ignored. Applying comment  for a new page works, if the page already exists editintro is ignored.

The texts taken from the MediaWiki: namespace are of course only examples, any existing page can be used for editintro or preload. Unfortunately preload does not yet work for the Special:Upload summary.

[edit] Caveats

[edit] Installation

  1. Download and save the file inputbox.php to the extensions folder of your MediaWiki installation. Make sure you use this link to download the extension, as the latest version in CVS does not work with the current MediaWiki release branch.
  2. Open and edit the LocalSettings.php file by adding the following line near the bottom:
require_once("extensions/inputbox.php");

NOTE: Make sure that it is still above the closing php tag so that it looks like this:

require_once("extensions/inputbox.php");
?>

[edit] Examples

Template:H:f

Personal tools