Difference between revisions of "Template:Infobox/doc"

From ShadowHaven Reloaded
Jump to navigation Jump to search
Tag: visualeditor
Tag: visualeditor-wikitext
Line 199: Line 199:
</pre>{{clear}}
</pre>{{clear}}
{{Help:Infobox/user style}}
{{Help:Infobox/user style}}
== Porting to other MediaWikis ==
The infobox template requires the ((:mw:Extension:Scribunto|Scribunto)) extension and ((mw:Manual:Using content from Wikipedia#HTMLTidy|HTMLTidy)) to be installed. It may not work with other MediaWikis. ((Wikipedia:WikiProject Transwiki|WikiProject Transwiki)) has a version of this template that has been modified to work on other MediaWikis.

Revision as of 02:24, 27 April 2020

Template:Documentation subpage

Script error: No such module "Parameter names example".

This template is intended as a meta template: a template used for constructing other templates. Note: In general, it is not meant for use directly in an article, but can be used on a one-off basis if required. ((Help:Infobox)) contains an introduction about the recommended content and design of infoboxes; ((Wikipedia:Manual of Style/Infoboxes)) contains additional style guidelines. See ((WP:List of infoboxes)) and ((:Category:Infobox templates)) for lists of prepared topic-specific infoboxes.

Usage

Subboxes

An alternative method for embedding is to use Template:Para, which removes the outer border from the infobox, but preserves the interior structure. One feature of this approach is that the parent and child boxes need not have the same structure, and the label and data fields are not aligned between the parent and child boxes because they are not in the same parent table.

Main 1
Main 2
Sub 3-1
Sub 3-2
Label 3-3Data 3-3
Label 4-1Data 4-1
Label 5Data 5
Main 6
{{Infobox
 | headerstyle = background-color:#eee;
 | labelstyle  = background-color:#eee;
 | header1 = Main 1
 | header2 = Main 2
 |   data3 = {{Infobox | subbox = yes
    | headerstyle = background-color:#ccc;
    | labelstyle  = background-color:#ddd;
    | header1 = Sub 3-1
    | header2 = Sub 3-2
    |  label3 = Label 3-3    |   data3 = Data 3-3
   }}
 |   data4 = {{Infobox | subbox = yes
    | labelstyle  = background-color:#ccc;
    |  label1 = Label 4-1    |   data1 = Data 4-1
   }}
 |  label5 = Label 5 |   data5 = Data 5
 | header6 = Main 6
}}

Template:Clear

Similar embedding techniques may be used within content parameters of some other templates generating tables (such as Template:Sidebar) :

Template:Sidebar

{{Sidebar
 | navbar = off
 | headingstyle = background-color:#eee;
 | heading1 = Heading 1
 | heading2 = Heading 2
 | content3 = {{Infobox | subbox = yes
    | headerstyle = background-color:#ccc;
    | labelstyle = background-color:#ddd;
    | header1 = Sub 3-1
    | header2 = Sub 3-2
    |  label3 = Label 3-3 |   data3 = Data 3-3
   }}
 | content4 = {{Infobox | subbox = yes
    | labelstyle = background-color:#ccc;
    |  label1 = Label 4-1 |   data1 = Data 4-1
   }}
 | heading5 = Heading 5
}}

Template:Clear

Note that the default padding of the parent data cell containing each subbox is still visible, so the subboxes are slightly narrower than the parent box and there's a higher vertical spacing between standard cells of the parent box than between cells of distinct subboxes.

Full blank syntax

(Note: there is no limit to the number of possible rows; only 20 are given below since infoboxes larger than that will be relatively rare. Just extend the numbering as needed. The microformat "class" parameters are also omitted as they are not commonly used.)

{{Infobox
| name           = {{subst:PAGENAME}}
| child          = {{{child|}}}
| subbox         = {{{subbox|}}}
| italic title   = {{{italic title|no}}}
| bodystyle      = 

| titlestyle     = 
| abovestyle     = 
| subheaderstyle = 
| title          = 
| above          = 
| subheader      = 

|   imagestyle   = 
| captionstyle   = 
|   image        = 
| caption        = 
|   image2       = 
| caption2       = 

| headerstyle    = 
|  labelstyle    = 
|   datastyle    = 
| header1  = 
|  label1  = 
|   data1  = 
| header2  = 
|  label2  = 
|   data2  = 
| header3  = 
|  label3  = 
|   data3  = 
| header4  = 
|  label4  = 
|   data4  = 
| header5  = 
|  label5  = 
|   data5  = 
| header6  = 
|  label6  = 
|   data6  = 
| header7  = 
|  label7  = 
|   data7  = 
| header8  = 
|  label8  = 
|   data8  = 
| header9  = 
|  label9  = 
|   data9  = 
| header10 = 
|  label10 = 
|   data10 = 
| header11 = 
|  label11 = 
|   data11 = 
| header12 = 
|  label12 = 
|   data12 = 
| header13 = 
|  label13 = 
|   data13 = 
| header14 = 
|  label14 = 
|   data14 = 
| header15 = 
|  label15 = 
|   data15 = 
| header16 = 
|  label16 = 
|   data16 = 
| header17 = 
|  label17 = 
|   data17 = 
| header18 = 
|  label18 = 
|   data18 = 
| header19 = 
|  label19 = 
|   data19 = 
| header20 = 
|  label20 = 
|   data20 = 

| belowstyle     = 
| below          = 
}}

Template:Clear

Infoboxes and user style

Users can have ((WP:User style|user CSS)) that hides any infoboxes in their own browsers.

To hide all infoboxes, add the following to ((Special:MyPage/common.css)) (for all ((WP:Skin|skins)), or ((Special:MyPage/skin.css)) for just the current skin), on a line by itself: <source lang="css">.infobox { display: none; }</source>

Alternatively, you can add the following code to ((Special:MyPage/common.js|your common.js)) or into a browser user script that is executed by an extension like ((Greasemonkey)):

<source lang="js">$('.infobox').hide();</source>


Needs Special:Mypage/common.js options for:

  • Making infoboxes collapsible
    • Making them auto-collapsed
  • Moving infoboxes to bottom of page

-->