User:Kumark/Inputbox
Installation[edit]
- Download and save the files
inputbox.php
andInputBox.i18n.php
to the extensions/inputbox/ folder of your MediaWiki installation. The most recent version ofinputbox.php
may not work on older MediaWiki installations. Version 1.17 works for MediaWiki 1.6.8.
You can as well check out from the subversion repository directly to the$IP/extensions/
folder, if you so wish:svn co http://svn.wikimedia.org/svnroot/mediawiki/trunk/extensions/inputbox/
- Open and edit the LocalSettings.php file by adding the following line near the bottom:
require_once($IP.'/extensions/inputbox/inputbox.php');
Example[edit]
Wiki code[edit]<inputbox> type=search width=42 buttonlabel=Go searchbuttonlabel=Search break=no </inputbox> |
Result[edit] |
This kind was found on the main page of a Wikipedia. It could be used for starting new articles, since it doesn’t go to the edit box of articles that already exist.
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 at least MediaWiki 1.5 and an extensions script (see #Installation above).
General syntax[edit]
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[edit]
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[edit]
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 Manual:Creating pages with preloaded text) into the blank editbox when a new page is created. |
<inputbox> type=create preload=Log </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 editing window. |
<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> |
hidden= create, comment This specifies that there is no inputbox. It is used with parameter "default", now not being a default, but the fixed value of the name of the page. |
<inputbox> type=comment editintro=Extension:Inputbox/editintro comment preload=Extension:Inputbox/preload hidden=yes default=Extension talk:Inputbox buttonlabel=Post a comment on the talk page </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> |
namespaces= search Support for namespace checkboxes in fulltext search. With " Namespace** " it is checked by default.
|
<inputbox> type=search namespaces=Main**,Help </inputbox> |
Applying create to an existing page simply gives the edit page. In that case preload
is ignored.
Applying comment for a new page works.
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, templates. parser functions and template parameters are not supported in inputbox parameters.
Alignment enhancement[edit]
I found that there was a need to define alignment each time I use an input box. I could have just removed the div
tag from the input box HTML and specified the div
when posting the inputbox. Instead I added a parameter that allows you to define the align in the code.
To use this, get an updated copy of the code here then you can specify align=left
, align=center
, or align=right
with the other parameters.
I hope you find it useful.
Known bugs[edit]
- bugzilla:5210 - <noinclude> and <includeonly> tags are not respected from a preloaded template.
- bugzilla:11777 - Multiple inputboxes make page invalid due to repetitive similar id
See also[edit]
- Meta: Help talk:Inputbox (needs to be moved here)
- Extension:CreateArticle
- Extension:CreateBox
- Extension:Preloader