Difference between revisions of "Help:Templates"

Ashes of Creation community empowered Wiki
Jump to navigation Jump to search
m
Line 167: Line 167:
 
== See also ==
 
== See also ==
  
 +
* [[:Category:TODO|Ashes of Creation Wiki's TODO list]]
 
* [[Help:Starting a new page|Starting a new page]]
 
* [[Help:Starting a new page|Starting a new page]]
 
* [[Help:Editing pages|Editing pages]]
 
* [[Help:Editing pages|Editing pages]]

Revision as of 19:11, 13 October 2018

A list of templates included within an article is visible at the bottom of that article's edit page.

Templates allow text to be included on several pages without duplicating the text. Templates are core to the way the Ashes of Creation Wiki is maintained because they allow relevant text to appear in multiple places without that text having to be duplicated manually.

  • For example, the article on Environments contains text on climate. This is the same text that is contained in the article on Seasons. This is achieved through the use of the {{Climate}} template, included on both pages.

Useful templates

The following templates are used throughout Ashes of Creation Wiki.

Article status

Used to flag the status of an article.

  • {{Draft}} at the top of an article page indicates that the page is work-in-progress.
Pages appear in Category:Draft articles.
  • {{Stub}} at the top of an article page indicates that the page needs significant editing.
Pages appear in Category:Stub articles.
Pages appear in Category:Transcripts.
Pages appear in Category:Raw transcripts.

Citations and references

  • {{Cn}} is specified at the point in the text where a citation is needed.
Pages appear in Category:Citation needed.
[[Leveling]] won't follow a traditional linear path, although classic mechanics for leveling exist.{{quote|leveling.png|link=https://discordapp.com/channels/256164085366915072/256164085366915072/281088406002597889}}
Encompassing each [[Servers|server]] are carefully placed points of development called [[Nodes]].{{web|https://www.ashesofcreation.com/a-reactive-world-nodes/|A reactive world - Nodes.}}

Template:Media citation templates

Read more...

Other handy templates

{{readmore|Lore}}
<blockquote>''There are hazards in game when you delve the dungeons, like wires or magical traps and pits that require utility items or spells to reveal, that each class will have a certain focus in. The light spell for example reveals magical explosive hazards.''{{quote|class utilities.png|link=https://discordapp.com/channels/256164085366915072/256164085366915072/278430394691616769}}{{ndash|[[Steven Sharif]]}}</blockquote>
{{cbox|[[File:Translation.svg.png|50px]]|We are translating [[Ashes of Creation Wiki]] into multiple languages. <br/>See [[Help:Translation|here]] for more information.|cbox-outer-padded}}

Creating templates

Templates are standard wiki pages whose content is designed to be embedded inside other pages. Templates follow a convention that the name is prefixed with "Template:". Besides this, you can create them like any other wiki page.

The simplest use of templates is as follows. If you create a page called "Template:Welcome" with contents:

Hello! Welcome to the wiki.

you'll have created your first template! If you then insert the code:

{{Welcome}}

in any other page, when that page is viewed the text

Hello! Welcome to the wiki.

will appear instead of {{Welcome}}. The template content is "embedded" into the other page.

Suppose it is used in 100 pages. If you then change the template contents to:

Hi there! Welcome to this wonderful wiki.

and revisit any of the 100 pages where the template was used, you'll see the new text instead of the original one. In this way, you have changed the content of 100 pages without editing them, because the template is embedded into these pages.

This is the basic mechanism. There are several additional features that make templates very useful.

Parameters

Parameters are used to pass information to a template when it is embedded. Parameters allow the template to produce different contents or have different behaviors.

Suppose you wish to insert a thank you note on a page with the name of the person being thanked embedded in the text. Create a template called "Template:Thankyou" as follows:

Thank you for your help with the wiki {{{1}}}!

You can then use this template by specifying the person's name as a parameter to it:

{{Thankyou|Rick}}

Notice the use of {{{1}}}. This is the way to identify, within templates, the parameters that will be passed in when the template is used. Note that, within the template, each parameter is surrounded by three braces: {{{ }}}.

When using the template on a page, you fill in the parameter values, separated by a "pipe" character (|).

The result will appear as:

Thank you for your help with the wiki Rick!

Default parameter values

Suppose we add a second parameter to the last example, to say who the thank you is from. Such as:

Thank you for your help with the wiki {{{1}}}!<br/>
From {{{2}}}.

If the template is called without the second parameter {{Thankyou|Rick}}, the result would be

Thank you for your help with the wiki Rick!
From .

To avoid this situation, you can use a default parameter value inside the template. The output will take on this value if the parameter is not being passed.

Thank you for your help with the wiki {{{1}}}!<br/>
From {{{2|the wiki team}}}.

Now if the template is called without the second parameter, the result would be

Thank you for your help with the wiki Rick!
From the wiki team.

Templated headings

We use templates with default parameters to adjust the heading levels inside templates to match those of the including page. For example: The template "Template:Games" contains headings and sub headings as follows:

Games can be roughly divided into two types.
=== Games I like ===
My favorite games are MMOs.
=== Games I don't like ===
My least favorite games are those with P2W.

Suppose we wish to include this template on the following regular page:

My favorite and least favorite things
=== Games ===
{{Games}}
=== Balloons ===
I like all balloons!

The result has all headings at the same level, which may be confusing to the reader:

My favorite and least favorite things

Games

Games I like

My favorite games are MMOs.

Games I don't like

My least favorite games are those with P2W.

Balloons

I like all balloons!

Instead, we use a template parameter with a default value to adjust the heading levels.

My favorite and least favorite things
=== Games ===
{{Games|====}}
=== Balloons ===
I like all balloons!

Template:Games page:

Games can be roughly divided into two types.
{{{1|===}}} Games I like {{{1|===}}}
My favorite games are MMOs.
{{{1|===}}} Games I don't like {{{1|===}}}
My least favorite games are those with P2W.

The result is much easier to read.

My favorite and least favorite things

Games

Games I like

My favorite games are MMOs.

Games I don't like

My least favorite games are those with P2W.

Balloons

I like all balloons!

See also