Difference between revisions of "Template:Infobox"

From Twinsuniverse
Jump to: navigation, search
m (testing substitution for themestyles)
m (finally removed the now obsolete layer and moved Template:Infobox/core back)
 
(46 intermediate revisions by the same user not shown)
Line 1: Line 1:
<includeonly>{{#vardefine: infobox_messages|<!-- initializer -->}}{{
+
<includeonly>{{#if:{{#varexists: infobox_messages}}||{{#vardefine: infobox_messages|<!-- initializer -->}}}}{{
 
#var_final: infobox_messages |
 
#var_final: infobox_messages |
}}<table class="infobox {{#if:{{{float|}}}|side}} {{{class|}}}" border="0" cellpadding="0" cellspacing="0"{{#if:{{{theme|}}}|<nowiki/> style="background-color:{{{mainbg}}}"}}>
+
}}<table class="infobox {{#if:{{{float|}}}|side}} {{lc:{{{class|}}}}}" border="0" cellpadding="0" cellspacing="0" style="{{Infobox/themes|{{{theme|}}}|style=main}}">
 
{{Infobox/row
 
{{Infobox/row
    |header={{#if: {{{title|}}} | {{{title}}} | {{PAGENAME}} }}
+
  |header={{#if: {{{title|}}}|{{{title}}}|{{PAGENAME}}}}
    |class=title
+
  |class=title
 +
  |titleclass={{#if: {{{theme|}}}|theme-icon-{{{theme|}}}}}
 +
  |titlestyle={{Infobox/themes|{{{theme|}}}|style=head}}
 
}}{{
 
}}{{
    #ifeq: {{{noimage|false}}} | false
+
#ifeq: {{{noimage|}}}|
    |{{Infobox/row
+
|{{Infobox/row
        |data={{articleimage |{{{image|}}}| {{{imagecaption|Image for article: {{PAGENAME}}}}} | nocat={{{nocat|false}}} }}
+
  |data={{articleimage|{{{image|}}}|{{{imagecaption|Image for article: {{PAGENAME}}}}}|nocat={{{nocat|false}}}}}
        |class=image}}
+
  |class=image
 +
  |datastyle={{Infobox/themes|{{{theme|}}}|style=data}}}}
 +
}}{{
 +
#vardefine: row|1}}{{
 +
#while:
 +
  |{{{ header{{#var:row}}|}}}{{{ label{{#var:row}}|}}}{{{ data{{#var:row}}|}}}{{{ class{{#var:row}}|}}}
 +
  |{{Infobox/row
 +
    |header={{{header{{#var:row}}|}}}
 +
    |label={{{label{{#var:row}}|}}}|data={{{data{{#var:row}}|}}}
 +
    |class={{{class{{#var:row}}|}}}
 +
    |datastyle={{Infobox/themes|{{{theme|}}}|style=data}}
 +
    |headstyle={{Infobox/themes|{{{theme|}}}|style={{
 +
      #ifeq: <!-- this condition can be quite confusing...
 +
                  basically if "header" is defined & non-empty and "class"=="header",
 +
                  the "lead" style should be used (which is for alternate headers), otherwise the default "head" style -->
 +
      {{{header{{#var:row}}|a}}}{{{class{{#var:row}}|}}}
 +
      |{{{header{{#var:row}}|b}}}heading
 +
      |lead|head}}}}
 +
  }}{{#vardefine: row|{{#expr: {{#var: row}} + 1 }}}}
 +
}}</table>{{#vardefine:infobox_messages
 +
  |{{#var:infobox_messages|}}{{maintenance|doclink={{{infoboxname|}}}|tasks={{#var:maintenance_message}}}}
 +
}}</includeonly><noinclude>{{Infobox Template
 +
|purpose=infobox
 +
|singletag=no
 +
|multiline=yes
 +
|gamerelated=no
 +
|suppressible=recursively
 +
|choice=
 +
|cat1=
 +
|var1=infobox_messages!!active
 +
|var2=maintenance_message!!active
 +
|var3=row
 
}}
 
}}
{{Infobox/row
+
 
    |header={{{header1|}}}
+
This template provides a generic infobox structure, and is used to implement new kinds of infoboxes for pages. It provides an {{templatelink|Infobox/row}} for rendering a title heading, an optional {{templatelink|articleimage}}, and an unlimited amount of rows for custom (data) headings.
    |label={{{label1|}}}
+
 
    |data={{{data1|}}}
+
Using this template directly on an article page is not recommended, as it would require a lot of repetitive wikicode. This template only provides a basic structure with base functionality, and does not automate headings or categorize pages on its own. Implement this generic infobox in a specific kind of infobox, to reuse the same headings and categorization mechanics across the different articles it will be used on.
    |class={{{class1|}}}
+
}}{{Infobox/row
+
    |header={{{header2|}}}
+
    |label={{{label2|}}}
+
    |data={{{data2|}}}
+
    |class={{{class2|}}}
+
}}{{Infobox/row
+
    |header={{{header3|}}}
+
    |label={{{label3|}}}
+
    |data={{{data3|}}}
+
    |class={{{class3|}}}
+
}}{{Infobox/row
+
    |header={{{header4|}}}
+
    |label={{{label4|}}}
+
    |data={{{data4|}}}
+
    |class={{{class4|}}}
+
}}{{Infobox/row
+
    |header={{{header5|}}}
+
    |label={{{label5|}}}
+
    |data={{{data5|}}}
+
    |class={{{class5|}}}
+
}}{{Infobox/row
+
    |header={{{header6|}}}
+
    |label={{{label6|}}}
+
    |data={{{data6|}}}
+
    |class={{{class6|}}}
+
}}{{Infobox/row
+
    |header={{{header7|}}}
+
    |label={{{label7|}}}
+
    |data={{{data7|}}}
+
    |class={{{class7|}}}
+
}}{{Infobox/row
+
    |header={{{header8|}}}
+
    |label={{{label8|}}}
+
    |data={{{data8|}}}
+
    |class={{{class8|}}}
+
}}{{Infobox/row
+
    |header={{{header9|}}}
+
    |label={{{label9|}}}
+
    |data={{{data9|}}}
+
    |class={{{class9|}}}
+
}}{{Infobox/row
+
    |header={{{header10|}}}
+
    |label={{{label10|}}}
+
    |data={{{data10|}}}
+
    |class={{{class10|}}}
+
}}{{Infobox/row
+
    |header={{{header11|}}}
+
    |label={{{label11|}}}
+
    |data={{{data11|}}}
+
    |class={{{class11|}}}
+
}}{{Infobox/row
+
    |header={{{header12|}}}
+
    |label={{{label12|}}}
+
    |data={{{data12|}}}
+
    |class={{{class12|}}}
+
}}{{Infobox/row
+
    |header={{{header13|}}}
+
    |label={{{label13|}}}
+
    |data={{{data13|}}}
+
    |class={{{class13|}}}
+
}}{{Infobox/row
+
    |header={{{header14|}}}
+
    |label={{{label14|}}}
+
    |data={{{data14|}}}
+
    |class={{{class14|}}}
+
}}{{Infobox/row
+
    |header={{{header15|}}}
+
    |label={{{label15|}}}
+
    |data={{{data15|}}}
+
    |class={{{class15|}}}
+
}}{{Infobox/row
+
    |header={{{header16|}}}
+
    |label={{{label16|}}}
+
    |data={{{data16|}}}
+
    |class={{{class16|}}}
+
}}{{Infobox/row
+
    |header={{{header17|}}}
+
    |label={{{label17|}}}
+
    |data={{{data17|}}}
+
    |class={{{class17|}}}
+
}}{{Infobox/row
+
    |header={{{header18|}}}
+
    |label={{{label18|}}}
+
    |data={{{data18|}}}
+
    |class={{{class18|}}}
+
}}{{Infobox/row
+
    |header={{{header19|}}}
+
    |label={{{label19|}}}
+
    |data={{{data19|}}}
+
    |class={{{class19|}}}
+
}}{{Infobox/row
+
    |header={{{header20|}}}
+
    |label={{{label20|}}}
+
    |data={{{data20|}}}
+
    |class={{{class20|}}}
+
}}{{Infobox/row
+
    |header={{{header21|}}}
+
    |label={{{label21|}}}
+
    |data={{{data21|}}}
+
    |class={{{class21|}}}
+
}}{{Infobox/row
+
    |header={{{header22|}}}
+
    |label={{{label22|}}}
+
    |data={{{data22|}}}
+
    |class={{{class22|}}}
+
}}{{Infobox/row
+
    |header={{{header23|}}}
+
    |label={{{label23|}}}
+
    |data={{{data23|}}}
+
    |class={{{class23|}}}
+
}}{{Infobox/row
+
    |header={{{header24|}}}
+
    |label={{{label24|}}}
+
    |data={{{data24|}}}
+
    |class={{{class24|}}}
+
}}{{Infobox/row
+
    |header={{{header25|}}}
+
    |label={{{label25|}}}
+
    |data={{{data25|}}}
+
    |class={{{class25|}}}
+
}}{{Infobox/row
+
    |header={{{header26|}}}
+
    |label={{{label26|}}}
+
    |data={{{data26|}}}
+
    |class={{{class26|}}}
+
}}{{Infobox/row
+
    |header={{{header27|}}}
+
    |label={{{label27|}}}
+
    |data={{{data27|}}}
+
    |class={{{class27|}}}
+
}}{{Infobox/row
+
    |header={{{header28|}}}
+
    |label={{{label28|}}}
+
    |data={{{data28|}}}
+
    |class={{{class28|}}}
+
}}{{Infobox/row
+
    |header={{{header29|}}}
+
    |label={{{label29|}}}
+
    |data={{{data29|}}}
+
    |class={{{class29|}}}
+
}}{{Infobox/row
+
    |header={{{header30|}}}
+
    |label={{{label30|}}}
+
    |data={{{data30|}}}
+
    |class={{{class30|}}}
+
}}
+
</table>{{#vardefine:infobox_messages
+
    |{{#var:infobox_messages|}}{{maintenance|doclink={{{infoboxname|}}}|tasks={{#var:maintenance_message}}}}
+
}}</includeonly><noinclude>
+
This template is used to show an infobox for an article. It should be the first of the article, before the general description.
+
This template uses it's [[Template:infobox/row|Row]] subpage for rendering title, optional [[Template:Articleimage|article image]], and 30 optional rows of custom data.
+
{{stub}}
+
  
 
==Parameters==
 
==Parameters==
* '''infoboxname''': The name of the infobox calling this template, for the link to documentation (case sensitive, defaults to no documentation link displayed)
+
* '''infoboxname''': The name of the template implementing this infobox, for the documentation link (case sensitive, defaults to no doclink)
* '''title''':
+
* '''title''': The title to use in the title heading of the infobox (optional, defaults to <nowiki>{{PAGENAME}}</nowiki>)
* '''float''': yes/no
+
* '''float''': Whether the infobox should float to the right (any non-empty value will do, defaults to no float)
* '''class''': one of the ''class'' values on the [[Template:{{PAGENAME}}/themes|themes]] subpage
+
* '''theme''': One of the [[/themes]] names for auto-styling the infobox (optional, defaults to stylesheet definitions)
* '''image''':
+
* '''class''': An optional custom class to add to the infobox (lowercase, CSS classname syntax, defaults to no extra class)
* '''imagecaption''':
+
* '''image''': The filename of the image to use as the infobox's article image (case sensitive, defaults to a default image)
* '''noimage''':
+
* '''imagecaption''': The text to show in the tooltip when the article image is hovered (case sensitive, defaults to <nowiki>'Image for article: {{PAGENAME}}'</nowiki>)
* '''nocat''':
+
* '''noimage''': Whether the article image should be disabled altogether for the infobox implementation (any value will disable the image, defaults to enabled)
...
+
* '''header#''', '''label#''', '''data#''' and '''class#''' from the [[/row]] subpage (for unlimited amount of rows, all default to hide row)
 +
* '''nocat''': Whether or not to suppress categorization by the {{templatelink|articleimage}} template (defaults to false, which means auto categorization).
 +
 
  
 
==Syntax==
 
==Syntax==
Line 184: Line 66:
  
 
  <nowiki>{{infobox
 
  <nowiki>{{infobox
  |class=
+
  |infoboxname=Infobox Something
 +
|title=
 +
|theme=
 +
|float=yes
 
  |image=
 
  |image=
  |imagecaption=
+
 
 +
  |header1=
 +
|label1=
 +
|data1=
 +
|class1=
 +
 
 +
|header2=
 +
|label2=
 +
|data2=
 +
|class2=
 
}}</nowiki>
 
}}</nowiki>
  
 
==Example==
 
==Example==
...
+
... this template is still under documentation ...
  
[[Category:System Templates]]
 
[[Category:Infoboxes| ]]
 
 
</noinclude>
 
</noinclude>

Latest revision as of 01:35, 8 June 2014

Infobox
Purpose

Infobox [list all]

Single tag

No [list all]

Multi-line

Yes [list all]

Protected

No [list all]

Game related

No [list all]

Categorization
Categories

none [list all]

Variables
Names

Multiple: [list all]

  • infobox_messages  (active)
  • maintenance_message  (active)
  • row  (free for reuse)
Subpages

This template provides a generic infobox structure, and is used to implement new kinds of infoboxes for pages. It provides an {{Infobox/row}} for rendering a title heading, an optional {{articleimage}}, and an unlimited amount of rows for custom (data) headings.

Using this template directly on an article page is not recommended, as it would require a lot of repetitive wikicode. This template only provides a basic structure with base functionality, and does not automate headings or categorize pages on its own. Implement this generic infobox in a specific kind of infobox, to reuse the same headings and categorization mechanics across the different articles it will be used on.

Parameters

  • infoboxname: The name of the template implementing this infobox, for the documentation link (case sensitive, defaults to no doclink)
  • title: The title to use in the title heading of the infobox (optional, defaults to {{PAGENAME}})
  • float: Whether the infobox should float to the right (any non-empty value will do, defaults to no float)
  • theme: One of the /themes names for auto-styling the infobox (optional, defaults to stylesheet definitions)
  • class: An optional custom class to add to the infobox (lowercase, CSS classname syntax, defaults to no extra class)
  • image: The filename of the image to use as the infobox's article image (case sensitive, defaults to a default image)
  • imagecaption: The text to show in the tooltip when the article image is hovered (case sensitive, defaults to 'Image for article: {{PAGENAME}}')
  • noimage: Whether the article image should be disabled altogether for the infobox implementation (any value will disable the image, defaults to enabled)
  • header#, label#, data# and class# from the /row subpage (for unlimited amount of rows, all default to hide row)
  • nocat: Whether or not to suppress categorization by the {{articleimage}} template (defaults to false, which means auto categorization).


Syntax

Copy and paste the following for quick use:

{{infobox
 |infoboxname=Infobox Something
 |title=
 |theme=
 |float=yes
 |image=

 |header1=
 |label1=
 |data1=
 |class1=

 |header2=
 |label2=
 |data2=
 |class2=
}}

Example

... this template is still under documentation ...