How to Create an Infobox: Difference between revisions
m (Text replacement - "\{\{[\s_]+([^•].)" to "{{$1") |
|||
(136 intermediate revisions by 6 users not shown) | |||
Line 7: | Line 7: | ||
|hours open=Mon 1pm - 6pm | |hours open=Mon 1pm - 6pm | ||
}} | }} | ||
==What are Infoboxes?== | ===What are Infoboxes?=== | ||
Infoboxes are nothing more than a table saved as a template. Infoboxes are usually in the upper right | Infoboxes are nothing more than a table saved as a template. Infoboxes are usually in the upper right hand corner of an article. May contain information on leadership, meeting times and it's goals, etc. | ||
==How to create an Infobox== | ===How to create an Infobox=== | ||
Again | Again an infobox is a table. If you know how to create tables in Wikitext or HTML, it is not difficult. If you do not know Wikitext or HTLM, you will probably need someone who does to help you. If you would like to learn these two programs, see [[Wikitext - Lesson One|Wikitext]] or [[HTML and Wikitext - Lesson One|HTML Programming]]. Neither of these programming languages are difficult. | ||
===Step One - Create the table=== | ====Step One - Create the table==== | ||
*We are going to assume you know a little Wikitext and HTML in this tutorial. We will begin by creating a simple table. The coding will be displayed in both Wikitext and HTML side by side so can see the difference. | *We are going to assume you know a little Wikitext and HTML in this tutorial. We will begin by creating a simple table. The coding will be displayed in both Wikitext and HTML side by side so can see the difference. It is recommended that you create infobox tables in HTML as there few problems as you will see. | ||
*We will be creating an infobox as shown above. Wikitext and HTML will be displayed side by side so you can see the difference between them. So let us create a infobox for an organization: | |||
*We will be creating an infobox as shown above. | |||
So let us create a infobox for an organization: | |||
<table style="border:1px solid blue; "> | <table style="border:1px solid blue; "> | ||
<tr> | <tr> | ||
<td style="border:1px solid blue; text-align:center; font-size:16pt; ">Wikitext</td> | <td style="width:50%; border:1px solid blue; text-align:center; font-size:16pt; ">Wikitext</td> | ||
<td style="border:1px solid blue; text-align:center; font-size:16pt; ">HTML</td> | <td style="width:50%; border:1px solid blue; text-align:center; font-size:16pt; ">HTML</td> | ||
</tr> | </tr> | ||
<tr> | <tr> | ||
<td style="border:1px solid blue; "> | <td style="width:50%; border:1px solid blue; "> | ||
<nowiki>{|</nowiki> | <nowiki>{| class="infobox"</nowiki> <br> | ||
<nowiki>|-</nowiki><br> | <nowiki>|-</nowiki><br> | ||
<nowiki>|colspan="2 | <nowiki>|colspan="2"|organization</nowiki><br><br> | ||
<nowiki>|-</nowiki><br> | <nowiki>|-</nowiki><br> | ||
<nowiki>|colspan="2"|image</nowiki><br><br> | <nowiki>|colspan="2"|image</nowiki><br><br> | ||
Line 45: | Line 42: | ||
</td> | </td> | ||
<td style="border:1px solid blue; "> | <td style="width:50%; border:1px solid blue; "> | ||
<nowiki><table | <nowiki><table class="infobox"></nowiki><br> | ||
<nowiki><tr></nowiki><br> | <nowiki><tr></nowiki><br> | ||
<nowiki><td colspan="2"></nowiki>organization<nowiki></td></nowiki><br> | <nowiki><td colspan="2"></nowiki>organization<nowiki></td></nowiki><br> | ||
Line 54: | Line 51: | ||
<nowiki></tr></nowiki><br> | <nowiki></tr></nowiki><br> | ||
<nowiki><tr></nowiki><br> | <nowiki><tr></nowiki><br> | ||
<nowiki><td>President:</td></nowiki><br> | <nowiki><td></nowiki>President:<nowiki></td></nowiki><br> | ||
<nowiki><td></nowiki>president<nowiki></td></nowiki><br> | <nowiki><td></nowiki>president<nowiki></td></nowiki><br> | ||
<nowiki></tr></nowiki><br> | <nowiki></tr></nowiki><br> | ||
<nowiki><tr></nowiki><br> | <nowiki><tr></nowiki><br> | ||
<nowiki><td>Address:</td></nowiki><br> | <nowiki><td></nowiki>Address:<nowiki></td></nowiki><br> | ||
<nowiki><td></nowiki>address<nowiki></td></nowiki><br> | <nowiki><td></nowiki>address<nowiki></td></nowiki><br> | ||
<nowiki></tr></nowiki><br> | <nowiki></tr></nowiki><br> | ||
<nowiki><tr></nowiki><br> | <nowiki><tr></nowiki><br> | ||
<nowiki><td>Phone:</td></nowiki><br> | <nowiki><td></nowiki>Phone:<nowiki></td></nowiki><br> | ||
<nowiki><td></nowiki>phone<nowiki></td></nowiki><br> | <nowiki><td></nowiki>phone Number<nowiki></td></nowiki><br> | ||
<nowiki></tr></nowiki><br> | <nowiki></tr></nowiki><br> | ||
<nowiki><tr></nowiki><br> | <nowiki><tr></nowiki><br> | ||
<nowiki><td>Hours Open:</td></nowiki><br> | <nowiki><td></nowiki>Hours Open:<nowiki></td></nowiki><br> | ||
<nowiki><td></nowiki>hours open<nowiki></td></nowiki><br> | <nowiki><td></nowiki>hours open<nowiki></td></nowiki><br> | ||
<nowiki></tr></nowiki><br> | <nowiki></tr></nowiki><br> | ||
Line 73: | Line 70: | ||
</tr> | </tr> | ||
</table> | </table> | ||
*Now pay close attention to the table tags. You should notice | *Now pay close attention to the table tags. You should notice this coding: <em>class="infobox"</em> in the table tag . This code tells the browser that a infobox is being created and to place it on the right hand side of the article. | ||
*As it stands, the HTML coding is ok at this point, but the Wikitext has a problem. Normally the Wikitext as is will work for any table, however, we are going to be installing <em>parameters</em> which require us to replace the |'s in the Wikitext with <nowiki>{{{!}}}</nowiki>. The reason is a bit beyond the scope of this article but if you are interested [[Template:!|click here]] | |||
*As it stands, the HTML coding is ok at this point, but the Wikitext has a problem. Normally the Wikitext as is will work for any table, however, we are going to be installing <em>parameters</em> which require us to replace the |'s in the Wikitext with | |||
<table style="border:1px solid blue; "> | <table style="border:1px solid blue; "> | ||
<tr> | <tr> | ||
<td style="border:1px solid blue; text-align:center; font-size:16pt; ">Wikitext</td> | <td style="width:50%; border:1px solid blue; text-align:center; font-size:16pt; ">Wikitext</td> | ||
<td style="border:1px solid blue; text-align:center; font-size:16pt; ">HTML</td> | <td style="width:50%; border:1px solid blue; text-align:center; font-size:16pt; ">HTML</td> | ||
</tr> | </tr> | ||
<tr> | <tr> | ||
<td style="border:1px solid blue; "> | <td style="width:50%; border:1px solid blue; "> | ||
<nowiki>{| class="infobox | <nowiki>{| class="infobox"</nowiki> <br> | ||
<nowiki>{{{!}}}-</nowiki><br> | |||
<nowiki>{{{!}}}organization</nowiki><br> | |||
<nowiki>{{{!}}}-</nowiki><br> | |||
<nowiki>{{{!}}}President:</nowiki><br> | |||
<nowiki>{{{!}}}president</nowiki><br><br> | |||
<nowiki>{{{!}}}-</nowiki><br> | |||
<nowiki>{{{!}}}Address:</nowiki><br> | |||
<nowiki>{{{!}}}address</nowiki><br><br> | |||
<nowiki>{{{!}}}-</nowiki><br> | |||
<nowiki>{{{!}}}Phone:</nowiki><br> | |||
<nowiki>{{{!}}}phone</nowiki><br><br> | |||
<nowiki>{{{!}}}-</nowiki><br> | |||
<nowiki>{{{!}}}Hours Open:</nowiki><br> | |||
<nowiki>{{{!}}}hours open</nowiki><br><br> | |||
<nowiki>|}</nowiki> | <nowiki>|}</nowiki> | ||
</td> | </td> | ||
<td style="border:1px solid blue; "> | <td style="width:50%; border:1px solid blue; "> | ||
<nowiki><table class="infobox" | <nowiki><table class="infobox"></nowiki><br> | ||
<nowiki><tr></nowiki><br> | <nowiki><tr></nowiki><br> | ||
<nowiki><td | <nowiki><td></nowiki>organization<nowiki></td></nowiki><br> | ||
<nowiki><tr></nowiki><br> | <nowiki><tr></nowiki><br> | ||
<nowiki><td></nowiki>President:<nowiki></td></nowiki><br> | <nowiki><td></nowiki>President:<nowiki></td></nowiki><br> | ||
Line 131: | Line 122: | ||
</tr> | </tr> | ||
</table> | </table> | ||
*The Wikitext looks a bit messy right now, but the substitution of the | *The Wikitext looks a bit messy right now, but the substitution of the {{{!}}} for the | will save a lot of headaches later. Notice that nothing had to be done to the HTML coding. Even though it looks like the Wikitext has less programming, it is a lot trickier to program infoboxes than in HTLM. That's why it is recommended to program infoboxes in HTML rather than Wikitext. | ||
===Step Two - More Coding=== | ====Step Two - More Coding==== | ||
*Next step is to | *Next step is to add parameters which are formated like so: {{{name of parameter}}}. We will add them to the table below. Notice that there are three opening and closing curly brackets around each one. | ||
<table style="border:1px solid blue; "> | <table style="border:1px solid blue; "> | ||
<tr> | <tr> | ||
<td style="border:1px solid blue; text-align:center; font-size:16pt; ">Wikitext</td> | <td style="width:50%; border:1px solid blue; text-align:center; font-size:16pt; ">Wikitext</td> | ||
<td style="border:1px solid blue; text-align:center; font-size:16pt; ">HTML</td> | <td style="width:50%; border:1px solid blue; text-align:center; font-size:16pt; ">HTML</td> | ||
</tr> | </tr> | ||
<tr> | <tr> | ||
<td style="border:1px solid blue; "> | <td style="width:50%; border:1px solid blue; "> | ||
<nowiki>{| class="infobox | <nowiki>{| class="infobox"</nowiki> <br> | ||
<nowiki>{{{!}}}-</nowiki><br> | <nowiki>{{{!}}}-</nowiki><br> | ||
<nowiki>{{{!}}} | <nowiki>{{{!}}}{{{organization}}}</nowiki><br> | ||
<nowiki>{{{!}}}-</nowiki><br> | <nowiki>{{{!}}}-</nowiki><br> | ||
<nowiki>{{{!}}}President:</nowiki><br> | <nowiki>{{{!}}}President:</nowiki><br> | ||
<nowiki>{{{!}}} | <nowiki>{{{!}}}{{{president}}}</nowiki><br><br> | ||
<nowiki>{{{!}}}-</nowiki><br> | <nowiki>{{{!}}}-</nowiki><br> | ||
<nowiki>{{{!}}}Address:</nowiki><br> | <nowiki>{{{!}}}Address:</nowiki><br> | ||
<nowiki>{{{!}}} | <nowiki>{{{!}}}{{{address}}}</nowiki><br><br> | ||
<nowiki>{{{!}}}-</nowiki><br> | <nowiki>{{{!}}}-</nowiki><br> | ||
<nowiki>{{{!}}}Phone:</nowiki><br> | <nowiki>{{{!}}}Phone:</nowiki><br> | ||
<nowiki>{{{!}}} | <nowiki>{{{!}}}{{{phone}}}</nowiki><br><br> | ||
<nowiki>{{{!}}}-</nowiki><br> | <nowiki>{{{!}}}-</nowiki><br> | ||
<nowiki>{{{!}}}Hours Open:</nowiki><br> | <nowiki>{{{!}}}Hours Open:</nowiki><br> | ||
<nowiki>{{{!}}} | <nowiki>{{{!}}}{{{hours open}}}</nowiki><br><br> | ||
<nowiki>|}</nowiki> | <nowiki>|}</nowiki> | ||
</td> | </td> | ||
<td style="border:1px solid blue; "> | <td style="width:50%; border:1px solid blue; "> | ||
<nowiki><table class="infobox" | <nowiki><table class="infobox"></nowiki><br> | ||
<nowiki><tr></nowiki><br> | <nowiki><tr></nowiki><br> | ||
<nowiki><td | <nowiki><td></nowiki>{{{organization}}}<nowiki></td></nowiki><br> | ||
<nowiki></td | |||
<nowiki><tr></nowiki><br> | <nowiki><tr></nowiki><br> | ||
<nowiki><td></nowiki>President:<nowiki></td></nowiki><br> | <nowiki><td></nowiki>President:<nowiki></td></nowiki><br> | ||
<nowiki><td></ | <nowiki><td></nowiki>{{{president}}}<nowiki></td></nowiki><br> | ||
<nowiki></tr></nowiki><br> | <nowiki></tr></nowiki><br> | ||
<nowiki><tr></nowiki><br> | <nowiki><tr></nowiki><br> | ||
<nowiki><td></nowiki>Address:<nowiki></td></nowiki><br> | <nowiki><td></nowiki>Address:<nowiki></td></nowiki><br> | ||
<nowiki><td></ | <nowiki><td></nowiki>{{{address}}}<nowiki></td></nowiki><br> | ||
<nowiki></tr></nowiki><br> | <nowiki></tr></nowiki><br> | ||
<nowiki><tr></nowiki><br> | <nowiki><tr></nowiki><br> | ||
<nowiki><td></nowiki>Phone:<nowiki></td></nowiki><br> | <nowiki><td></nowiki>Phone:<nowiki></td></nowiki><br> | ||
<nowiki><td></ | <nowiki><td></nowiki>{{{phone}}}<nowiki></td></nowiki><br> | ||
<nowiki></tr></nowiki><br> | <nowiki></tr></nowiki><br> | ||
<nowiki><tr></nowiki><br> | <nowiki><tr></nowiki><br> | ||
<nowiki><td></nowiki>Hours Open:<nowiki></td></nowiki><br> | <nowiki><td></nowiki>Hours Open:<nowiki></td></nowiki><br> | ||
<nowiki><td></ | <nowiki><td></nowiki>{{{hours open}}}<nowiki></td></nowiki><br> | ||
<nowiki></tr></nowiki><br> | <nowiki></tr></nowiki><br> | ||
<nowiki></table></nowiki> | <nowiki></table></nowiki> | ||
Line 193: | Line 175: | ||
</tr> | </tr> | ||
</table> | </table> | ||
*Notice all we have done | *Notice all we have done is enclose the parameter we want to place information with opening and closing {{{ }}}. That is all. It will be in the parameters where we put the information that we see in the infobox. | ||
*In the wikitext, things are really getting hard to differentiate. There are a lot of curly brackets on the code | *In the wikitext, things are really getting hard to differentiate. There are a lot of curly brackets on the code. | ||
===Step Three - Placing the Infobox=== | ===Step Three - Placing the Infobox=== | ||
*To place this infobox we type the usual coding we use to place templates, which | *To place this infobox we type the usual coding we use to place templates, which our example is <nowiki>{{Infobox sample}}</nowiki>. However, it will be displayed as such:{{Infobox sample}}. | ||
*Notice no information appears | *Notice no information appears only the parameters inside the curly brackets. We now have to add the following code inside the placement coding<br><br> | ||
<nowiki>{{Infobox sample</nowiki><br> | <nowiki>{{Infobox sample</nowiki><br> | ||
<nowiki>|organization=</nowiki><br> | |||
<nowiki>|image=</nowiki><br> | <nowiki>|image=</nowiki><br> | ||
<nowiki>|president=</nowiki><br> | <nowiki>|president=</nowiki><br> | ||
<nowiki>|address=</nowiki><br> | <nowiki>|address=</nowiki><br> | ||
<nowiki>|phone=</nowiki><br> | <nowiki>|phone=</nowiki><br> | ||
<nowiki>|open hours=</nowiki><br | <nowiki>|open hours=</nowiki><br> | ||
<nowiki>}}</nowiki> | <nowiki>}}</nowiki> | ||
*Notice that for every parameter there is a | *Notice that for every parameter there is a |, the name of the parameter followed by an = sign. It is after the = sign that you add the proper information for the organization. For example, if you are wanting to place the name of the president you would type it after the = sign like so: <nowiki>|president=John Smith</nowiki>. | ||
{{Infobox sample | {{Infobox sample | ||
|organization=Genealogy Society | |organization=Genealogy Society | ||
Line 218: | Line 200: | ||
}} | }} | ||
That is all there is to it. Simple. | That is all there is to it. Simple. | ||
*When you save the page, the | *When you save the page, the <nowiki>{{{president}}}</nowiki> is replaced by John Smith. | ||
*Now if we add the following information after the = signs like so: | *Now if we add the following information after the = signs like so: | ||
<nowiki>{{Infobox sample</nowiki><br> | <nowiki>{{Infobox sample</nowiki><br> | ||
<nowiki>|organization= | <nowiki>|organization=[[File:France Lavender Field.jpg|150px]]</nowiki><br> | ||
<nowiki>|organization=</nowiki>Society Name<br> | |||
<nowiki>|president=</nowiki | <nowiki>|president=</nowiki>John Smith<br> | ||
<nowiki>|address=</nowiki | <nowiki>|address=</nowiki>1234 Hill St, Any City<br> | ||
<nowiki>|phone=</nowiki | <nowiki>|phone=</nowiki>360-555-1234<br> | ||
<nowiki>|open hours=</nowiki | <nowiki>|open hours=</nowiki>Mon 1pm - 6pm<br> | ||
<nowiki>}}</nowiki> | <nowiki>}}</nowiki> | ||
*We will get the following: | *We will get the following: | ||
{{Infobox sample | {{Infobox sample | ||
|organization=Genealogy Society | |organization=Genealogy Society | ||
Line 242: | Line 220: | ||
|hours open=Mon 1pm - 6pm | |hours open=Mon 1pm - 6pm | ||
}} | }} | ||
== | ===Step Four - Limiting Parameters=== | ||
Some infoboxes can get very long. If you list all the attributes of an organization can possibly there can be quit a few items listed. What if you placing an infobox for a small organization, but are using the infobox for a large organizations with many offices you could end up with an infobox taking up a lot of room on the page with little information in it. Maybe the organization does even have a phone number. Well it is possible to code the infobox so that the item "phone" does not appear if there is none. It is done simply by adding this coding to the parameter. | |||
Revision as of 18:41, 17 September 2014
Genealogy Society | |
![]() |
|
President: | John Smith |
Address: | 1234 Hill St, Any City |
Phone: | 360-555-1234 |
Hours Open: | Mon 1pm - 6pm |
What are Infoboxes?[edit | edit source]
Infoboxes are nothing more than a table saved as a template. Infoboxes are usually in the upper right hand corner of an article. May contain information on leadership, meeting times and it's goals, etc.
How to create an Infobox[edit | edit source]
Again an infobox is a table. If you know how to create tables in Wikitext or HTML, it is not difficult. If you do not know Wikitext or HTLM, you will probably need someone who does to help you. If you would like to learn these two programs, see Wikitext or HTML Programming. Neither of these programming languages are difficult.
Step One - Create the table[edit | edit source]
- We are going to assume you know a little Wikitext and HTML in this tutorial. We will begin by creating a simple table. The coding will be displayed in both Wikitext and HTML side by side so can see the difference. It is recommended that you create infobox tables in HTML as there few problems as you will see.
- We will be creating an infobox as shown above. Wikitext and HTML will be displayed side by side so you can see the difference between them. So let us create a infobox for an organization:
Wikitext | HTML |
{| class="infobox" |
<table class="infobox"> |
- Now pay close attention to the table tags. You should notice this coding: class="infobox" in the table tag . This code tells the browser that a infobox is being created and to place it on the right hand side of the article.
- As it stands, the HTML coding is ok at this point, but the Wikitext has a problem. Normally the Wikitext as is will work for any table, however, we are going to be installing parameters which require us to replace the |'s in the Wikitext with {{{!}}}. The reason is a bit beyond the scope of this article but if you are interested click here
Wikitext | HTML |
{| class="infobox" |
<table class="infobox"> |
- The Wikitext looks a bit messy right now, but the substitution of the {{{!}}} for the | will save a lot of headaches later. Notice that nothing had to be done to the HTML coding. Even though it looks like the Wikitext has less programming, it is a lot trickier to program infoboxes than in HTLM. That's why it is recommended to program infoboxes in HTML rather than Wikitext.
Step Two - More Coding[edit | edit source]
- Next step is to add parameters which are formated like so: {{{name of parameter}}}. We will add them to the table below. Notice that there are three opening and closing curly brackets around each one.
Wikitext | HTML |
{| class="infobox" |
<table class="infobox"> |
- Notice all we have done is enclose the parameter we want to place information with opening and closing {{{ }}}. That is all. It will be in the parameters where we put the information that we see in the infobox.
- In the wikitext, things are really getting hard to differentiate. There are a lot of curly brackets on the code.
Step Three - Placing the Infobox[edit | edit source]
- To place this infobox we type the usual coding we use to place templates, which our example is {{Infobox sample}}. However, it will be displayed as such:
{{{organization}}} {{{image}}} Phone: {{{phone}}} Hours Open: {{{hours open}}} .
- Notice no information appears only the parameters inside the curly brackets. We now have to add the following code inside the placement coding
{{Infobox sample
|organization=
|image=
|president=
|address=
|phone=
|open hours=
}}- Notice that for every parameter there is a |, the name of the parameter followed by an = sign. It is after the = sign that you add the proper information for the organization. For example, if you are wanting to place the name of the president you would type it after the = sign like so: |president=John Smith.
Genealogy Society President: John Smith Address: 1234 Hill St, Any City Phone: 360-555-1234 Hours Open: Mon 1pm - 6pm
That is all there is to it. Simple.- When you save the page, the {{{president}}} is replaced by John Smith.
- Now if we add the following information after the = signs like so:
{{Infobox sample
|organization=[[File:France Lavender Field.jpg|150px]]
|organization=Society Name
|president=John Smith
|address=1234 Hill St, Any City
|phone=360-555-1234
|open hours=Mon 1pm - 6pm
}}- We will get the following:
Genealogy Society President: John Smith Address: 1234 Hill St, Any City Phone: 360-555-1234 Hours Open: Mon 1pm - 6pm
Step Four - Limiting Parameters[edit | edit source]
Some infoboxes can get very long. If you list all the attributes of an organization can possibly there can be quit a few items listed. What if you placing an infobox for a small organization, but are using the infobox for a large organizations with many offices you could end up with an infobox taking up a lot of room on the page with little information in it. Maybe the organization does even have a phone number. Well it is possible to code the infobox so that the item "phone" does not appear if there is none. It is done simply by adding this coding to the parameter.
- Notice no information appears only the parameters inside the curly brackets. We now have to add the following code inside the placement coding