Template:Infobox/doc: Difference between revisions
m Replaced content with "This template is used for creating other infobox templates." Tags: Replaced 2017 source edit |
mNo edit summary Tag: 2017 source edit |
||
| (4 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
The '''Infobox template''' is a universal base template designed for creating information boxes in wiki articles. It serves as the foundation for specialized infoboxes (e.g., for [[Template:Gorge|gorges]], cities, rivers, etc.), ensuring a standardized appearance and structure. | |||
=== Using Infobox in specialized templates === | |||
To create a new infobox for a specific type of object, you need to use the Infobox template within your own template, passing the appropriate parameters. | |||
* <code><nowiki>{{Infobox ... }}</nowiki></code> — includes the base infobox. | |||
* title, image, description, header color — are passed directly to Infobox. | |||
* parameters — contains a list of fields that will be displayed if provided in the template (e.g., country, region). | |||
=== Creating a new infobox based on Infobox === | |||
To create a new infobox (for example, for a city), follow the structure below and adjust the list of parameters for the desired object. Example structure for a city infobox: | |||
<pre> | |||
<includeonly> | |||
{{Infobox | |||
| title = {{{city name|}}} | |||
| image = {{{photo|}}} | |||
| description = {{{description|}}} | |||
| header color = #87CEEB | |||
| parameters = | |||
{{#if:{{{country|}}} | <div class="infobox-row"> | |||
<div class="infobox-label">Country:</div> | |||
<div class="infobox-value">[[{{{country}}}]]</div> | |||
</div> }} | |||
{{#if:{{{population|}}} | <div class="infobox-row"> | |||
<div class="infobox-label">Population:</div> | |||
<div class="infobox-value">{{{population}}}</div> | |||
</div> }} | |||
}} | |||
</includeonly> | |||
</pre> | |||
=== Additional parameters === | |||
When creating templates based on <code><nowiki>{{Infobox}}</nowiki></code>, you can add additional parameters for inserting maps, links to thematic portals and other sections at your discretion: | |||
<pre> | |||
{{#if:{{{map|}}} | <div class="infobox-map">{{{map}}}</div> }} | |||
{{#if:{{{portal|}}} | | |||
<div class="infobox-section" style="background:#ffe2b8;">Thematic Portals</div> | |||
<div class="infobox-portal">{{{portal}}}</div> | |||
}} | |||
</pre> | |||
Now this template can be used in city articles as follows: | |||
<pre> | |||
{{City | |||
| city name = Paris | |||
| photo = Paris.jpg | |||
| description = View of the Eiffel Tower | |||
| country = France | |||
| population = 2,165,423 | |||
}} | |||
</pre> | |||
=== How to customize Infobox for your needs? === | |||
# Choose the type of object for which you need an infobox (city, river, nature reserve, etc.). | |||
# Create a new template that uses Infobox as its base. | |||
# Add the necessary parameters by passing them to the parameters section. | |||
# Customize the infobox by changing the header color, adding new fields, and adjusting styles. | |||
__NOINDEX__ | |||
<noinclude>[[Category:Template documentation]]</noinclude> | |||
Latest revision as of 12:33, 17 February 2025
The Infobox template is a universal base template designed for creating information boxes in wiki articles. It serves as the foundation for specialized infoboxes (e.g., for gorges, cities, rivers, etc.), ensuring a standardized appearance and structure.
Using Infobox in specialized templates
To create a new infobox for a specific type of object, you need to use the Infobox template within your own template, passing the appropriate parameters.
{{Infobox ... }}— includes the base infobox.- title, image, description, header color — are passed directly to Infobox.
- parameters — contains a list of fields that will be displayed if provided in the template (e.g., country, region).
Creating a new infobox based on Infobox
To create a new infobox (for example, for a city), follow the structure below and adjust the list of parameters for the desired object. Example structure for a city infobox:
<includeonly>
{{Infobox
| title = {{{city name|}}}
| image = {{{photo|}}}
| description = {{{description|}}}
| header color = #87CEEB
| parameters =
{{#if:{{{country|}}} | <div class="infobox-row">
<div class="infobox-label">Country:</div>
<div class="infobox-value">[[{{{country}}}]]</div>
</div> }}
{{#if:{{{population|}}} | <div class="infobox-row">
<div class="infobox-label">Population:</div>
<div class="infobox-value">{{{population}}}</div>
</div> }}
}}
</includeonly>
Additional parameters
When creating templates based on {{Infobox}}, you can add additional parameters for inserting maps, links to thematic portals and other sections at your discretion:
{{#if:{{{map|}}} | <div class="infobox-map">{{{map}}}</div> }}
{{#if:{{{portal|}}} |
<div class="infobox-section" style="background:#ffe2b8;">Thematic Portals</div>
<div class="infobox-portal">{{{portal}}}</div>
}}
Now this template can be used in city articles as follows:
{{City
| city name = Paris
| photo = Paris.jpg
| description = View of the Eiffel Tower
| country = France
| population = 2,165,423
}}
How to customize Infobox for your needs?
- Choose the type of object for which you need an infobox (city, river, nature reserve, etc.).
- Create a new template that uses Infobox as its base.
- Add the necessary parameters by passing them to the parameters section.
- Customize the infobox by changing the header color, adding new fields, and adjusting styles.