How to Create an Infobox: Difference between revisions
Line 220: | Line 220: | ||
|hours open=Mon 1pm - 6pm | |hours open=Mon 1pm - 6pm | ||
}} | }} | ||
*Notice that we use the usual coding for placing an image. We have limited the image to 150px wide as the infobox is 200px wide. If you did not limit the size of the image. the infobox would expand to the width of the image as it stands in the files. | |||
===Step Four - Limiting Parameters=== | ===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. | 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:44, 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
- Notice that we use the usual coding for placing an image. We have limited the image to 150px wide as the infobox is 200px wide. If you did not limit the size of the image. the infobox would expand to the width of the image as it stands in the files.
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