Templates

From WWR

Jump to: navigation, search
HOW-TO
Getting started
How-tos
How-to FAQ
Ask Mr. Monkey (Q&A)
Editing cheat sheet
Tagging songs
User pages
Talk pages
Create a sandbox
Uploading photos

Templates are used to add recurring messages to pages in a consistent way, to add boilerplate messages and to create navigational boxes. After a template is added to a page, any changes to the template are shown on the page.

The Whole Wheat Radio wiki uses templates extensively for adding information about artists, albums and songs. On WWR they are also called tags, stickers or info boxes.

Any page beginning with a name beginning, "Template:", such as "Template:name", is considered a wiki template.

Contents

Adding a template to a page

To add a template to a page:

  1. Access the page and click the "Edit" tab.
  2. In the edit box type two left pointing curly brackets, then the name of the template (without the namespace prefix), followed by two right pointing curly brackets. (i.e., {{name}})
  3. Click the "Save" button to save the page.
  4. The contents of the template are now displayed on the page.

Alternatively, you can add {{subst:name}} to pages on which you want to use the template contents. Upon saving the page the wiki software places one-time copy of the template contents into the page in place of the template tag. If the template is later modified, pages in which the template was placed using the "subst:" prefix are not updated.

Creating and editing templates

You make a new template the same way you create a regular page. The difference is that its title must start with "Template:".

Customarily, a template's talk page is used to describe the template and how to use it in addition to discussion about the template.

Edit templates the same way you edit pages. If the template tag in a page looks like {{foo}}, go to Template:foo to edit it. To get there, use the "Go" or "Search" feature, make a link in the sandbox and click on it, or type the URL in the browser's address bar.

Be aware that your edit might affect many pages. To find the pages on which the template is placed, access the templates page and use "What links here" from the toolbox.

FAQ

Are templates case sensitive? 
Yes, except the first letter.
Can I add parameters? 
Yes. The most comprehensive reference on working with wikimedia templates is on the wikipedia website. A brief tutorial is on the User info boxes page
How many templates can I use in a page? 
As many as you like.
I edited the template, so why didn't the page it is used on change? 
There are some caching bugs and you'll need to force your browser to refresh/reload the page. One way to force a refresh is to click the edit link on the page in which the template appears, and to then click Save page without having changed anything - there is no need to fill in the Summary field since there will not be any history of this as a change generated. Alternatively, refreshing by pressing Ctrl and F5 often helps.
Can I move a template to a new name? 
Yes, this works in exactly the same way as regular page moves. When a page calls for inclusion of a template that is a redirect page, the redirect target is included instead.
Can I use a template within a template? 
You can use a template tag within template content, but not within a template tag: in the latter case the parser prematurely ends the original template tag when it reaches the first pair of curly closing braces.

Examples

Following are but a few of the templates used on WWR.

Music tags

{{Artist website}}
[unknown Website]

{{Tag}}
Acoustic
9,237 items

User info boxes

{{Musician}} Template:Musician
{{Mr. Monkey crush}} Template:Mr. Monkey crush

Info boxes

Add these to any appropriate page. {{Quick links}}

QUICK LINKS
Listen (hi-speed)
Listen (med-speed)
Listen (lo-speed)
What's playing?

{{Quick start}}

QUICK LINKS
Listen (hi-speed)
Listen (med-speed)
Listen (lo-speed)
What's playing?

See also

Emoticons

The emoticon wikitag is not actually a template, but using the emoticon wikitag is an easy way to add graphics from the emoticon library to templates.

To use any emoticon from the emoticon library, type what you want to emot.

Example:

<emoticon>happy</emoticon>

Displays:

happy

The emoticon library is here, Emoticon library. Hover your mouse over an image to see its name. The leading double colons are now optional. Some standards are:

smile smile frown frown bugeye bugeye

The system tries very hard to match your emotion to a good emoticon. It always gives you something, even if it can't quite figure out what you want. Note that if the system can't figure out exactly what you want, it will change guesses between "Show preview" and the actual "Save page". Right now, there is no way to avoid this except to specify the exact emoticon you want to use using the old emoticon library cheat sheet. (See Randycon.)

Personal tools
 Cinema
0.24 secs to build