Help:Wiki University Wikitext--Infobox - Creating





<< Previous Chapter Next Chapter >>

What are infoboxes
Infoboxes are used to display brief information typically about organizations and/or administrative divisions like US counties. They allow quick reference to people and locations.
 * Infoboxes are tables saved as templates. These templates are then embedded into the wikitext coding on a page.
 * The standard practice is to place infoboxes near the top right side of the page. To the right is an example of an Oregon County, Missouri infobox:

Advantages of infoboxes

 * Infoboxes are coded to allow entering different data values for each page they are on.
 * What makes infoboxes useful is the ability to add or change information within them without having to edit the template itself.
 * If you think you might need to change a template on a particular page, use the "subst:" procedure as taught in the lesson on Templates when embeding it.

Let's create an infobox for an organization
Here is the coding: 


 * NOTICE we used colspan in the first two rows.
 * NOTICE we have centered the name "organization" and "image."
 * NOTICE the float: right so the infobox will appear on the right side of the page.
 * Nothing really unusual in the coding so far. However, now we are going to introduce a new concept called parameters.

Parameters

 * Parameters are "place holders" that allow the input of information into the infobox.
 * Parameters are formed by three opening and closing curly brackets:

In our infobox, it is in the cells where the parameters are located that we want to post our data value such as the name of the president next to the cell with the title "President."

Infobox parameters
We will place three opening and closing curly brackets around those items we desire to convert into parameters: 
 * NOTICE all you have to do to turn an item into a "parameter" is surround it with three curly brackets.

Rename Parameters

 * Sometimes the parameter name does not clearly identify the desired data value to use. We can rename a parameter by adding a pipe after the parameter name followed by the new name.

Here's what the coding will look like now: 


 * The resulting infobox contains parameters that are a little more self-explanatory -- particularly, in this case, for the image parameter:

Saving infobox
To save the infobox template, use the word "infobox" somewhere in the title like so: template:Name of Society Infobox

CAUTION: When doing your infobox exercise, be sure to adhere to the restrictions for saving a template when saving your work. See sample below and refer to Ch 13-Templates. template:your username/sandbox/Name of Society Infobox

That is all there is to creating an infobox. The next chapter will cover how to embed the infobox and where the parameters come into play.

Try these out


 Exercises

Use this coding for the exercise: Lets make this into a infobox: Check your answers
 * 1) Add a border around the infobox, limit the width to 240 pixels and place it on the right side of the page.
 * 2) Add borders around each of the cells.
 * 3) Have the cells containing the words organization and image span both columns.
 * 4) Center the name of the organization and the image in their cells.
 * 5) Make the items in the right hand cells into parameters.
 * 6) Rename the parameters to make them more understandable.

 Quick Quiz
 * Parameters have two opening and closing curly brackets surrounding them.
 * A. True
 * B. False


 * Infoboxes are usually located at the top of the page on the right side.
 * A. True
 * B. False


 * Infoboxes are saved just like other templates but it is good practice to include the word "infobox" in the title.
 * A. True
 * B. False

Check your answers

<< Previous Chapter Next Chapter >>