Template:Infobox person: Difference between revisions

From WikiAlpha
mNo edit summary
Tag: Reverted
No edit summary
 
(9 intermediate revisions by 3 users not shown)
Line 1: Line 1:
<table class="infobox" style="width:22em; border:1px solid #a2a9b1; border-collapse:collapse; background-color:#f8f9fa;">
<noinclude>
<tr>
{{Infobox person
<th colspan="2" class="infobox-title" style="text-align:center; font-size:125%; font-weight:bold; color:black; background-color:#eaecf0; padding:0.25em;">{{#if:{{{title|}}}|{{{title}}}|{{PAGENAME}}}}</th>
| name        = Jimmy Wales
</tr>
| image       = Jimmy Wales.jpg
{{#if:{{{above|}}}|
| caption     =The image of Wikipedia founder.  
<tr>
| occupation  = Author
<td colspan="2" class="infobox-above" style="text-align:center; font-size:110%; font-weight:bold; padding:0.25em;">{{{above}}}</td>
| notable_works = [[Wikipedia]]
</tr>}}
| awards      =  
{{#if:{{{image|}}}|
<tr>
<td colspan="2" class="infobox-image" style="text-align:center; padding:0.25em;">[[File:{{{image}}}|{{#if:{{{image_size|}}}|{{{image_size}}}|250px}}]]{{#if:{{{caption|}}}|<br /><small>{{{caption}}}</small>}}</td>
</tr>}}
{{#if:{{{header1|}}}|
<tr>
<th colspan="2" class="infobox-subheader" style="text-align:center; background-color:#eaecf0; padding:0.25em;">{{{header1}}}</th>
</tr>}}
{{{content|}}}
{{#if:{{{header2|}}}|
<tr>
<th colspan="2" class="infobox-subheader" style="text-align:center; background-color:#eaecf0; padding:0.25em;">{{{header2}}}</th>
</tr>}}
{{#if:{{{additional_content|}}}|{{{additional_content}}}}}
{{#if:{{{header3|}}}|
<tr>
<th colspan="2" class="infobox-subheader" style="text-align:center; background-color:#eaecf0; padding:0.25em;">{{{header3}}}</th>
</tr>}}
{{#if:{{{additional_content2|}}}|{{{additional_content2}}}}}
{{#if:{{{below|}}}|
<tr>
<td colspan="2" class="infobox-below" style="text-align:center; padding:0.25em;">{{{below}}}</td>
</tr>}}
</table><noinclude>
 
[[Category:Infobox templates]]
[[Category:Layout templates]]
[[Category:Base templates]]
 
== Description ==
This is the base template for all infoboxes. It provides a standardized structure and styling for information boxes across the wiki.
 
== Usage ==
This template is not meant to be used directly on articles. Instead, use specialized infobox templates for specific article types.
 
If you need to create a new infobox template, you can build upon this base template. Here's an example of how to create a derived infobox:
 
<pre>
{{Infobox
|title = {{#if:{{{name|}}}|{{{name}}}|{{PAGENAME}}}}
|image = {{{image|}}}
|image_size = {{{image_size|}}}
|caption = {{{caption|}}}
|content =
{{#if:{{{field1|}}}|
<tr>
<td class="infobox-label">Field 1</td>
<td class="infobox-data">{{{field1}}}</td>
</tr>
}}
}}
{{#if:{{{field2|}}}|
<tr>
<td class="infobox-label">Field 2</td>
<td class="infobox-data">{{{field2}}}</td>
</tr>
}}
<!-- Add more fields as needed -->
}}
</pre>
== Parameters ==
* '''title''' - Title of the infobox (defaults to page name if not specified)
* '''above''' - Text to display above the title
* '''image''' - Filename of an image to display (without the File: prefix)
* '''image_size''' - Size of the image (defaults to 250px if not specified)
* '''caption''' - Caption text for the image
* '''header1''' - First section header
* '''content''' - Main content of the infobox (typically rows of label/data pairs)
* '''header2''' - Second section header
* '''additional_content''' - Additional content after header2
* '''header3''' - Third section header
* '''additional_content2''' - Additional content after header3
* '''below''' - Text to display at the bottom of the infobox
== Styling ==
This template uses standardized classes for consistent styling:
* '''.infobox-title''' - The main title at the top
* '''.infobox-above''' - The text above the title
* '''.infobox-image''' - The main image container
* '''.infobox-subheader''' - Section headers within the infobox
* '''.infobox-label''' - The left column labels
* '''.infobox-data''' - The right column data
* '''.infobox-full-data''' - Data that spans both columns
* '''.infobox-below''' - The text at the bottom
== Example ==
Here is an example of how a derived infobox template might be structured:
<pre>
{{Infobox
|title = Example Item
|image = Example.jpg
|image_size = 220px
|caption = An example item
|header1 = Basic Information
|content =
<tr>
<td class="infobox-label">Type</td>
<td class="infobox-data">Example type</td>
</tr>
<tr>
<td class="infobox-label">Created</td>
<td class="infobox-data">2025</td>
</tr>
|header2 = Additional Details
|additional_content =
<tr>
<td class="infobox-label">Feature</td>
<td class="infobox-data">Example feature</td>
</tr>
|below = This is an example only.
}}
</pre>
<templatedata>
{
  "description": "Base template for all infoboxes on the wiki. Not meant to be used directly on articles.",
  "params": {
    "title": {
      "label": "Title",
      "description": "Title displayed at the top of the infobox (defaults to page name if not specified)",
      "type": "string"
    },
    "above": {
      "label": "Above",
      "description": "Text to display above the title",
      "type": "string"
    },
    "image": {
      "label": "Image",
      "description": "Filename of an image to display (without the File: prefix)",
      "type": "string"
    },
    "image_size": {
      "label": "Image size",
      "description": "Width of the image in pixels (px)",
      "type": "string",
      "default": "250px"
    },
    "caption": {
      "label": "Caption",
      "description": "Caption text for the image",
      "type": "string"
    },
    "header1": {
      "label": "Header 1",
      "description": "First section header",
      "type": "string"
    },
    "content": {
      "label": "Content",
      "description": "Main content of the infobox (typically rows of label/data pairs)",
      "type": "string"
    },
    "header2": {
      "label": "Header 2",
      "description": "Second section header",
      "type": "string"
    },
    "additional_content": {
      "label": "Additional content",
      "description": "Additional content after header2",
      "type": "string"
    },
    "header3": {
      "label": "Header 3",
      "description": "Third section header",
      "type": "string"
    },
    "additional_content2": {
      "label": "Additional content 2",
      "description": "Additional content after header3",
      "type": "string"
    },
    "below": {
      "label": "Below",
      "description": "Text to display at the bottom of the infobox",
      "type": "string"
    }
  }
}
</templatedata>
</noinclude>
</noinclude>
<div class="infobox" style="width: 22em; border: 1px solid #aaa; border-collapse: collapse; margin: 10px; float: right; background: #f9f9f9;">
    <table style="width: 100%; border: none;">
        <tr>
            <th colspan="2" style="background: #e9e9e9; text-align: center;">{{#if: {{{name|}}} | {{{name}}} | "Unknown Name"}}</th>
        </tr>
        <tr>
            <td colspan="2" style="text-align: center;">
                {{#if: {{{image|}}}
                    | [[File:{{{image}}}|thumb|200px|center]]
                    | <span style="font-style: italic;">No image available</span>
                }}
            </td>
        </tr>
        {{#if: {{{caption|}}}
            | <tr>
                <td colspan="2" style="align: center; text-align: center; font-style: italic;">{{{caption}}}</td>
            </tr>
        }}
        {{#if: {{{birth_date|}}}
            | <tr>
                <th style="text-align: left;">Born</th>
                <td>{{{birth_date}}}</td>
            </tr>
        }}
        {{#if: {{{birth_place|}}}
            | <tr>
                <th style="text-align: left;">Place of Birth</th>
                <td>{{{birth_place}}}</td>
            </tr>
        }}
        {{#if: {{{nationality|}}}
            | <tr>
                <th style="text-align: left;">Nationality</th>
                <td>{{{nationality}}}</td>
            </tr>
        }}
        {{#if: {{{occupation|}}}
            | <tr>
                <th style="text-align: left;">Occupation</th>
                <td>{{{occupation}}}</td>
            </tr>
        }}
        {{#if: {{{notable_works|}}}
            | <tr>
                <th style="text-align: left;">Notable Works</th>
                <td>{{{notable_works}}}</td>
            </tr>
        }}
        {{#if: {{{awards|}}}
            | <tr>
                <th style="text-align: left;">Awards</th>
                <td>{{{awards}}}</td>
            </tr>
        }}
      {{#if: {{{website|}}}
            | <tr>
                <th style="text-align: left;">Website</th>
                <td>{{{website}}}</td>
            </tr>
        }}
    </table>
</div>

Latest revision as of 06:53, 27 May 2026


Jimmy Wales
The image of Wikipedia founder.
Occupation Author
Notable Works Wikipedia
"Unknown Name"
               No image available