Help:Inputbox

From Wikipedia, the free encyclopedia

This is a copy of the master help page at Meta. Do not edit this copy.
Edits will be lost in the next update from the master page. See below for more information.
Editing
Start new pages
Page name

Referencing
Links
Piped links
Interwiki linking
Footnotes (References)

Formatting
Wikitext
Lists & Tables
Image & file uploads
Formulae

Organising
Sections
Categories
Redirects (forward)
Namespaces
Moving a page
Page size

Fixing mistakes
Reverting edits
Show preview

Saving effort
Editing shortcuts
Edit toolbar
Magic words
Templates
Variables
Calculation

Communicating
Edit summary
Talk page
Edit conflict
Minor edit

Other
Characters
Sandbox


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

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.

Box types

Type Example
type=search
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


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


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.


Parameters

Parameter
Scope
Example
bgcolor=
All types
 
Sets the table background color (HTML color values). Do not use quotes.
<inputbox>
type=search
bgcolor=#eeeeff
</inputbox>
width=
All types
 
Sets the width of the inputbox in characters.
<inputbox>
type=create
width=24
</inputbox>


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


preload=
comment, create
 
The page under this title will be preloaded (see below) into the blank editbox when a new page is created.
<inputbox>
type=create
preload=MediaWiki:Editthispage
</inputbox>


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


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


searchbuttonlabel=
search
 
This label will be used for the "Search full text" button of the search form.
<inputbox>
type=search
searchbuttonlabel=Dig deeper
</inputbox>
break=
All types
 
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
width=24
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.

Please note that variables and templates are not supported in inputbox parameters.

Preload

Preloading can be done with an inputbox (see above), but also with a URL like http://meta.wikimedia.org/wiki/abc?action=edit&preload=Template:Preload_demo which links to the edit box of a new page, preloaded with m:Template:Preload demo (backlinks, edit).

The wikitext of the preloaded page, including noinclude parts and tags but excluding includeonly tags, is loaded into the editbox if the target page does not exist yet. If the target of the preload operation already exists then only its wikitext is loaded, the preload command is ignored.

The fact that the includeonly tags are not included can be utilized by putting "subst:" inside them, to define a noinclude part (without using noinclude tags):

{{<includeonly>subst:</includeonly>#ifeq: {{<includeonly>subst:</includeonly>FULLPAGENAME}}| name of preloaded page| noinclude part| includeonly part}}

Installation

  1. Download and save the file inputbox.php to the extensions folder of your MediaWiki installation.
  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");
?>
  1. May need to add the following User:Algorithm/actionCreate


edit

Wikipedia-specific help

Texts in the preload and editintro examples (under the conditions listed above):

  1. {{ MediaWiki:Editthispage }} = Edit this page
  2. {{ MediaWiki:Missingcommenttext }} = Please enter a comment below.

This page is a copy of the master help page at Meta (for general help information all Wikimedia projects can use), with two Wikipedia-specific templates inserted. To update the main text, edit the master help page for all projects at m:Help:Inputbox. For Wikipedia-specific issues, use Template:Ph:Inputbox (the extra text at the bottom of this page) or Template:Phh:Inputbox for a Wikipedia-specific lead (text appears at the top of this page). You are welcome to replace the full wikitext of this page with that of the master page at Meta at any time. To view this page in other languages see the master page at Meta.