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.

1. Create a table

 * Here is the coding of a sample table:




 * NOTE:
 * we used colspan in the first two rows.
 * we have centered the name "organization name" and "image."
 * the float: right attribute is used to place the infobox on the right side of the page.
 * To the right is a preview of the table:

2. Add Infobox Parameters

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


 * Where are parameters placed?
 * >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."
 * >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.

3. 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 the Infobox as a Template

 * Now that your infobox table has been created and saved in your sandbox, you need to create an infobox template.


 * To create the infobox template, perform the following steps:
 * 1. Create a new page using the word "Infobox" somewhere in the title like so:

template:Template name Infobox


 * 2. Copy the wikitext coding for your table into the infobox template and save the template.

CAUTION: When doing your infobox exercise, be sure to adhere to the restrictions for saving a template using the format below. (Refer to Ch 13-Templates.) template:your username/sandbox/emplate name 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 >>