User:Wonghk3/Sandbox/WikiTextA3

CH-13: TEMPLATES
FOLLOW samples on tutorial page... Templates

DEFINITION of a TEMPLATE
 * a container of FIXED (non-changing) CODE that can be embedded anywhere on a page and onto many pages
 * may be text, tables, images, etc
 * used to standardize page sections
 * some templates allow for us to input 'values' that provide data or links to a page

SHOW EXAMPLES
 * Example of text/table: Aberton Parish
 * Check the breadcrumb trail and Jurisdiction Table


 * Example of image template:

HOW TO CREATE A TEMPLATE 1. Created the same way an ordinary article is created 2. In Search box, type Template:user-defined Template-name 3. Click on Create the page 4. Build template instructions in the edit box, then save page

HOW TO EDIT A TEMPLATE go to page where template is used, click on edit source Click Scroll to the bottom of the page and note list of templates Click Locate template of interest, then click on "Edit" OR

if you know the template, search on that template use example

CAUTION: Editing a template will change all pages where this template is embedded. Many templates have sub-templates within them which makes following the code difficult

HOW TO EMBED A TEMPLATE ENTER onto the page without the word Template

use sample

HOW TO EDIT ONLY ONE EMBEDDED TEMPLATE (use subst:template-name}}
 * To allow a template to be customized only on one page without changing the other pages using that template
 * When a template is embedded in this manner and one clicks "Edit this Page", they will see all the code used to create the template

ENTER to embed template on that one page

LIMITATIONS The size of a template is defined by the code used IN that template and cannot be adjusted when embedding

CH-14: INFOBOX- CREATING
FOLLOW samples on tutorial page... Templates

WHAT ARE INFOBOXES


 * A specialized table in the form of a display box placed on a page.
 * The box contains quick references about people, locations, organizations, or administrative divisions.

ADVANTAGES OF INFOBOXES


 * ability to add/change info within them w/o editing the template
 * template can be changed on a particular page using "subst:" procedure
 * are coded to be edited only for the page on which they are embedded

CREATING AN INFOBOX WITH RENAMED PARAMETERS


 * Coding includes: open/close Table-tags, rows, and cells
 * the box is floated to the right side of the page using the attribute "float:right" in the Table-tag
 * first two rows use colspan="2" code to combine two columns in the table
 * parameters are added to accept user-input values by placing opening and closing curly brackets in the table: 
 * rename the parameters by ADDING a pipe after the parameter name, then ADDING an explanatory parameter name



SAVING THE INFOBOX template:Name of Society Infobox
 * Save the template using the word infobox in the title

CH-15: INFOBOX - PLACING
FOLLOW samples on tutorial page... Templates

PLACING (EMBEDDING) AN INFOBOX; ADDING PARAMETER VALUES STEP 1: copy this infobox template into sandbox
 * Now that we've created (and presumably saved) an infobox, we need to place or embed that infobox onto a page.
 * I will demonstrate the steps using an infobox named  

STEP 2: add the parameters you used when you created the infobox between the curly brackets (I happened to look it up for this infobox)

STEP 3: add the values for each parameter, then 'show preview'


 * SEE RESULTS on right of page
 * Here's an EXAMPLE of infobox coding with values for Jackson County, Missouri


 * Here's an EXAMPLE of a Wiki Page (use to review coding): Abberley Parish, England

CH-16: INFOBOX - IF FUNCTION
FOLLOW samples on tutorial page... Templates

PLACING (EMBEDDING) AN INFOBOX; ADDING PARAMETER VALUES


 * Using the Infobox U.S. County parameters (in sandbox) for Jackson, SHOW what happens if you remove the value (Independence) for the parameter county seat (seat wl).
 * RESULTS: just leaves a blank space
 * The question we might ask is: if we have a very long infobox, do we really want to list ALL the parameters even if most are blank? NO!
 * We use the IF FUNCTION to decide what to do if the value for that parameter is not entered; the line is removed from the infobox.

'''WHAT and WHERE is the code PLACED?


 * Code is placed in Original Infobox Code
 * Compare Wikitext Ch-14 Original infobox code with Wikitext Ch-16 If function infobox code
 * follow Wiki University script under Heading=If functions

'''SHOW EXAMPLE of CODE from Abberley Parish


 * copy infobox code from Abberley to sandbox
 * show preview and bring attention to Location of Archive --> Worcestershire Record Office
 * remove the Worchestershire Record Office value and show preview
 * NOTE: unlike the removal of the Jackson County Seat, the VALUE, LINE, and HEADER is not now displayed
 * this allows us to create long infoboxes

PROBLEM WITH PIPES


 * sometimes Wiki gets confused by all the pipes used in code ...GO THROUGH Wiki University documentation for this section --> replace pipe with |