User:Wonghk3/sandbox/Infobox-Create

What are infoboxes
Infoboxes are used to display brief information typically about organizations and/or administrative divisions like US counties, but in a table form. They allow quick reference to people and locations.
 * Infoboxes are usually tables saved as templates, then embedded onto each division page.
 * We usually place them 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 input of different data values.
 * 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: The restrictions for saving practice templates are also in force when saving practice infoboxes: Template:User:ccsmith/sandbox/Name of Society infobox
 * NOTICE: BE SURE TO REPLACE "ccsmith" with "your user login name".

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