To request editing rights on the Wiki, click here.

User:Wonghk3/Sandbox/WU-Template

From FamilySearch Wiki
Revision as of 12:54, 3 October 2018 by Wonghk3 (talk | contribs) (Wonghk3 moved page User:Wonghk3/Sandbox/WU-Templates to User:Wonghk3/Sandbox/WU-Template: remove the s because I only have one template for this purpose)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Lessons


Intermediate


Advanced


Flexbox


Additional Helps


<< Previous Chapter Next Chapter >>

What are templates? (This page is a BACKUP of the ORIGINAL page)[edit | edit source]

  • 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.
  • Here is an example of an image template: {{CommunityTree}}
A FamilySearch Community Tree is available for this place.
Healthy Foods
Foods with short shelf life Foods with long shelf life
Fruits Vegetable Nuts Grains
Apples Peas Peanuts Wheat
Pears Carrots Walnuts Oats
Cherries Corn Cashews Barley
Orange Beans Almonds Buckwheat

How to create templates[edit | edit source]

  • It is created just like an ordinary article.
  • The main difference between an ordinary article and a template is how it is saved.
  • To save it as a template you type in the Search box: "Template:" (take note of the colon after the word template) and the title you want to give it.
Template:Template name
  • NOTICE the location of the word template and the colon. If the word template and its colon are missing, you will be saving another article instead of a template.

How to embed a template[edit | edit source]

  • To embed a template, you type the following code where you want the template to appear:
{{Template name}}
  • 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.

Html7.jpg

To find all the templates embedded on a page, click the "Edit source" tab in the tool bar and then go down below the edit box. There you will see a complete list of all templates on the page. This will include all sub templates that may be part of the ones actually seen on the page. Many templates have templates in them as well, which can make following the code very difficult.

  • 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 only one embedded template[edit | edit source]

  • To get around this problem, if you think you will be making changes to a template and don't want to affect the others, use this coding to embed the template:
{{subst:name of template}}

  • NOTICE: The word "subst" and the colon before the name of the template. This allows the template to be embedded in the article with the ability to be edited and only show up on the page it is embedded in.
  • NOTICE: This time if you were to click on "Edit this Page", you will see all the code used to create the template.

Html7.jpg

This is very useful if you are going to create many pages using the same format but want the ability to customize each page after it is created without changing the other pages using that template.

Editing templates[edit | edit source]

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

Limiting size of templates[edit | edit source]

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

Try these out[edit | edit source]

Tests.gif
Exercises
  • What is the coding to save a template?
  • What is the coding to embed a template?
  • What is the coding to embed a 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
<< Previous Chapter Next Chapter >>