User:Wonghk3/Sandbox





<< Previous Chapter Next Chapter >>

What are templates?
According to the Macmillan dictionary, a template is:
 * (a) something that is used as a pattern or an example for something else
 * (b) COMPUTING: a computer file that copies are made from because its basic form can be used again and again
 * (c) an object made of metal, plastic, or thin board that is used as a pattern for cutting things in the same shape


 * A container of such things as text, tables, images, etc. that can be embedded anywhere on a page.
 * It can be just about anything from a complete page of many words, images and tables to a small box with a link or two.
 * AND it is material you want to add to many pages without having to type or copy and paste it into each article you want your material to appear.
 * Whatever is in the template will be the same in each article you embed the template.
 * To the right is an example of an image template:
 * Below is an example of a table template:

How to create a template

 * Templates are normally created by an administrator or their designate.


 * To create a template, type in the Search box: "Template:" followed by the name or title you want to give it. (take note of the colon after the word template)

Template:Template name
 * NOTICE the word Template must be followed by a colon. If the word template and its colon are missing, you will be saving an ordinary article, not a template.
 * CAUTION!  For practice exercises, please follow the creating/saving instructions found below under the heading "Restrictions on template creation and embedding".

How to embed a template
 
 * To embed a template, you type the following code on the page you want the template to appear:
 * You can put the template anywhere on a page.
 * NOTICE you do not type the word template with the colon between the curly brackets. You type only the name you gave the template.
 * NOTICE if you were to click on "Edit source" in the tool bar to see the coding for the template, you will only see the curly brackets, and the name of the template, not the coding that was used to create the template.
 * NOTICE to see the coding of a template, you need to click on the template name in the list below the edit box and then click on "Edit source."

Editing templates

 * Editing a template is just like editing an article. Go to the template by typing "template:name of template" exactly like you saved it.  Then edit as normal.
 * This is critical to understand: Whenever you edit a template, those changes will show up in the template wherever it is embedded.  This can be good or it can be a problem.
 * >This is a good thing if it is a template that needs updating from time to time. This saves you from having to go to every page the template is embedded to edit it.
 * >This can be a problem because if you want to update one particular template on a specific page and not all of them, you can't.

Editing only one embedded template
 
 * There may be occasions where you desire to change a template on only one article without impacting other articles that contain the same template.
 * To do so, use the following code to embed the template:
 * Steps to take when using "subst:" include:
 * ENTER the template onto a page using the subst: format above, then SAVE the page.
 * EDIT the source code on the page. (NOTICE what you see is the wikitext coding used to create the template.  It replaces the template on that page.)
 * MODIFY the coding to your specifications, then SAVE the page.

Limiting size of templates

 * Templates are limited in size in the code of the template. So if you want the template to only be so many pixels wide you have to put that in the code of the template.  You can't adjust it while embedding it.

Restrictions on template creation and embedding
Currently there are hundreds of templates in use on the Wiki pages. To assure that templates created "for use" on the Wiki pages are distinguished from those created "during training", the following policy will apply:

1. CREATE and SAVE a new page with the following title: Template:your username/sandbox/Template name 2. EDIT the new page with the text, table, or image you want displayed, then SAVE. For this example, we will enter the following text: THIS PAGE IS MY TEMPLATE PRACTICE PAGE 3. Test the template by EMBEDDING it in another sandbox using your template name, in the following format:  
 * NOTICE:  when embedding, the word "Template" and the "colon" are removed from the title and the remaining title is enclosed within curly brackets.

Try these out


 Exercises Check your answers
 * What is the coding to save a template with the name 'Lorem ipsum'?
 * What is the coding to embed this template?
 * What is the coding to embed this template that you might want to edit someday?

 Quick Quiz
 * Templates are easy to change.
 * A. True
 * B. False


 * Change the template and wherever it is embedded is changed as well.
 * A. True
 * B. False


 * There is no way to change a template without changing it wherever it is embedded.
 * A. True
 * B. False

Check your answers

<< Previous Chapter Next Chapter >>