Help:Wiki University Wikitext--Infobox - Creating

From FamilySearch Wiki
Jump to: navigation, search
MAIN PAGE
WIKI
WIKITEXT
HTML/CSS
FAMILY HISTORY CENTERS
VISUAL EDITOR

Lessons


Intermediate


Advanced


Flexbox


Additional Helps

What are infoboxes

Oregon County, Missouri
Map
Map of Missouri highlighting Oregon County
Location in the state of Missouri
Map of the U.S. highlighting Missouri
Location of Missouri in the U.S.
Facts
Founded February 14, 1845
County Seat Alton
Courthouse
Address Oregon County Courthouse
PO Box 324
Alton, MO 65606
Phone: 417.778.7475
Oregon County Website


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.

How to create an Infobox Table

1. Create a table

Here is the coding of a sample table:

{| style="width:200px; border:1px solid black;float:right"
|-
|colspan="2" style="text-align:center"|organization name
|-
|colspan="2" style="text-align:center"|image
|-
| President:
| president
|-
| Address:
| address
|-
| Phone:
| phone
|-
| Hours Open:
| hours open
|}

organization name
image
President: president
Address: address
Phone: phone
Hours Open: hours open
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:

{{{name of parameter}}}


  • 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:

{| style="width:200px; border:1px solid black; float:right"
|-
|colspan="2" style="text-align:center" |{{{organization name}}}
|-
|colspan="2" style="text-align:center" |{{{image}}}
|-
|President:
|{{{president}}}
|-
| Address:
| {{{address}}}
|-
| Phone:
| {{{phone}}}
|-
| Hours Open:
| {{{hours open}}}
|}

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:

{| style="width:200px; border:1px solid black; float:right"
|-
|colspan="2" style="text-align:center" |{{{organization name|Name of Organization}}}
|-
|colspan="2" style="text-align:center" |{{{image|Image goes here}}}
|-
| President:
| {{{president|President's name}}}
|-
| Address:
| {{{address|Address}}}
|-
| Phone:
| {{{phone|Phone number}}}
|-
| Hours Open:
| {{{hours open|Hours opened}}}
|}


  • The resulting infobox contains parameters that are a little more self-explanatory -- particularly, in this case, for the image parameter:
Name of Organization
Image goes here
President: President's name
Address: Address
Phone: Phone number
Hours Open: Hours opened

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/Template 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

Tests.gif
Exercises

Use this coding for the exercise:

{|
|-
|organization
|-
|image
|-
|President:
|president
|-
|Address:
|address
|-
|Phone:
|phone
|-
|Hours Open:
|hours open
|}

Lets make this into a infobox:

  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

Navigation menu