Difference between revisions of "Template:Infobox"

From Twinsuniverse
Jump to: navigation, search
(fixed the loop iterator)
m (finally removed the now obsolete layer and moved Template:Infobox/core back)
 
(8 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}} {{lc:{{{class|}}}}}" border="0" cellpadding="0" cellspacing="0" style="{{{mainstyle|}}}">
+
}}<table class="infobox {{#if:{{{float|}}}|side}} {{lc:{{{class|}}}}}" border="0" cellpadding="0" cellspacing="0" style="{{Infobox/themes|{{{theme|}}}|style=main}}">
{{Infobox/row | header={{#if: {{{title|}}} | {{{title}}} | {{PAGENAME}} }} | class=title
+
{{Infobox/row
    | titleclass={{{titleclass|}}} | titlestyle={{{headstyle|}}}
+
  |header={{#if: {{{title|}}}|{{{title}}}|{{PAGENAME}}}}
 +
  |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}}}}}|class=image
+
  |data={{articleimage|{{{image|}}}|{{{imagecaption|Image for article: {{PAGENAME}}}}}|nocat={{{nocat|false}}}}}
        |datastyle={{{datastyle|}}}}}
+
  |class=image
}}
+
  |datastyle={{Infobox/themes|{{{theme|}}}|style=data}}}}
{{#vardefine: row|1}}{{#while: {{{ {{#var:row}}|}}}
+
}}{{
 +
#vardefine: row|1}}{{
 +
#while:
 +
  |{{{ header{{#var:row}}|}}}{{{ label{{#var:row}}|}}}{{{ data{{#var:row}}|}}}{{{ class{{#var:row}}|}}}
 
   |{{Infobox/row
 
   |{{Infobox/row
 
     |header={{{header{{#var:row}}|}}}
 
     |header={{{header{{#var:row}}|}}}
     |label={{{label{{#var:row}}|}}}
+
     |label={{{label{{#var:row}}|}}}|data={{{data{{#var:row}}|}}}
    |data={{{data{{#var:row}}|}}}
+
 
     |class={{{class{{#var:row}}|}}}
 
     |class={{{class{{#var:row}}|}}}
     |datastyle={{{datastyle|}}}
+
     |datastyle={{Infobox/themes|{{{theme|}}}|style=data}}
     |headstyle={{#ifeq:{{{header{{#var:row}}|a}}}{{{class{{#var:row}}|}}}|{{{header{{#var:row}}|b}}}heading|{{{leadstyle|}}}|{{{headstyle|}}}}}
+
     |headstyle={{Infobox/themes|{{{theme|}}}|style={{
   }}{{#vardefine: row|{{#expr: {{#var: row}}+1 }}}}
+
      #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
 
}}</table>{{#vardefine:infobox_messages
    |{{#var:infobox_messages|}}{{maintenance|doclink={{{infoboxname|}}}|tasks={{#var:maintenance_message}}}}
+
  |{{#var:infobox_messages|}}{{maintenance|doclink={{{infoboxname|}}}|tasks={{#var:maintenance_message}}}}
 
}}</includeonly><noinclude>{{Infobox Template
 
}}</includeonly><noinclude>{{Infobox Template
 
  |purpose=infobox
 
  |purpose=infobox
Line 30: Line 41:
 
  |cat1=
 
  |cat1=
 
  |var1=infobox_messages!!active
 
  |var1=infobox_messages!!active
  |var2=row
+
  |var2=maintenance_message!!active
 +
|var3=row
 
}}
 
}}
  
This template is used to show an infobox for a page. It should be the first of the page, before the general description.
+
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.
This template also uses the {{templatelink|Infobox/row}} template for rendering a title, an optional {{templatelink|articleimage}}, and 30 optional rows of 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.
'''''Note''': This template provides the main functionality of the {{templatelink|Infobox}}, whereas the latter further automates the theme selection. These may be merged later.''
+
  
 
==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''': The title to use in the top heading of the infobox (optional, defaults to <nowiki>{{PAGENAME}}</nowiki>)
+
* '''title''': The title to use in the title heading of the infobox (optional, defaults to <nowiki>{{PAGENAME}}</nowiki>)
* '''float''': Whether the infobox should float to the right (any value will do, defaults to no float)
+
* '''float''': Whether the infobox should float to the right (any non-empty value will do, defaults to no float)
* '''mainstyle''': The CSS statements to use for the theme colours of the main infobox rectangle (optional, defaults to stylesheet colours)
+
* '''theme''': One of the [[/themes]] names for auto-styling the infobox (optional, defaults to stylesheet definitions)
* '''headstyle''': The CSS statements to use for the theme colours of the full-width headings (optional, defaults to stylesheet colours)
+
* '''class''': An optional custom class to add to the infobox (lowercase, CSS classname syntax, defaults to no extra class)
* '''leadstyle''': The CSS statements to use for the theme colours of the alternate full-width headings (optional, defaults to stylesheet colours)
+
* '''datastyle''': The CSS statements to use for the theme colours of the data cells (optional, defaults to stylesheet colours)
+
* '''class''': One of the theme titles on the [[Template:Infobox/themes|themes]] subpage, or a custom class (lowercase, multiple values are space-delimited, defaults to no class)
+
 
* '''image''': The filename of the image to use as the infobox's article image (case sensitive, defaults to a default image)
 
* '''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 <nowiki>'Image for article: {{PAGENAME}}'</nowiki>)
 
* '''imagecaption''': The text to show in the tooltip when the article image is hovered (case sensitive, defaults to <nowiki>'Image for article: {{PAGENAME}}'</nowiki>)
* '''noimage''': Whether the article image should be absent altogether (any value will do, defaults to false)
+
* '''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).
 
* '''nocat''': Whether or not to suppress categorization by the {{templatelink|articleimage}} template (defaults to false, which means auto categorization).
  
Line 58: 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
+
... this template is still under documentation ...
  
 
</noinclude>
 
</noinclude>

Latest revision as of 00: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 ...