Template:Infobox/doc: Difference between revisions

From Nguhcraft Wiki
Jump to navigation Jump to search
mh>Viklo
(added example infobox)
mh>Viklo
mNo edit summary
Line 1: Line 1:
{{Infobox|
{{Infobox|
{{Infobox title|Example ŋation}}
{{Infobox above|Example ŋation}}
{{Infobox row|Ruler|Eggs Ample}}
{{Infobox row|Ruler|Eggs Ample}}
{{Infobox row|Languages|Examplese<br>Examplian}}
{{Infobox row|Languages|Examplese<br>Examplian}}
Line 8: Line 8:
<pre><nowiki>
<pre><nowiki>
{{Infobox|
{{Infobox|
{{Infobox title|{{{name|}}}}}
{{Infobox above|{{{name|}}}}}
{{Infobox row|Ruler|{{{ruler|}}}}}
{{Infobox row|Ruler|{{{ruler|}}}}}
{{Infobox row|Languages|{{{languages|}}}}}
{{Infobox row|Languages|{{{languages|}}}}}

Revision as of 00:17, 14 March 2024

Template:Infobox aboveTemplate:Infobox rowTemplate:Infobox row

This is a template for creating (classic) infoboxes. Classic infoboxes are essentially an HTML table with CSS to make it look like an infobox. This template just contains the outer <table> element, and it takes one unnamed parameter which is the content inside the infobox. The different infobox components themselves require a bit of CSS and other things, so there are templates for those as well. It is mainly intended for creating infobox templates that are in turn used in articles, but it can be used directly as well. An infobox template page might contain text that looks something like this:

{{Infobox|
{{Infobox above|{{{name|}}}}}
{{Infobox row|Ruler|{{{ruler|}}}}}
{{Infobox row|Languages|{{{languages|}}}}}
}}

The line breaks are not necessary. The parameters for this template would be name, ruler and languages. The | after the parameter names means that the default value is what comes after the | (i.e. nothing). The helper templates have an if statement that makes it so that they only appear if a non-empty value is provided. This means that if ruler, for example, is left empty or omitted, that row will not show up.