Help:Templates

From STIQ

Jump to: navigation, search
PD
Important note: When you edit this page, you agree to release your contribution into the public domain. If you don't want this or can't do this because of license restrictions, please don't edit. This page is one of the Public Domain Help Pages, which can be freely copied into fresh wiki installations and/or distributed with MediaWiki software; see Help:Contents for an overview of all pages.

If you have standard texts you want to include on several pages, the MediaWiki template feature comes into play (like the tag above which is included in the pages of the Help namespace).

Contents

Creating a template

Template names are prefixed with Template:, you create them like any other wiki page.

Using a template

Templates are wiki pages which can be used in other pages in three ways:

  • {{Name}} includes the content of the template at the moment the page containing it is fetched "[[Template:Name]]".
  • {{subst:Name}} inserts the content of the template into the code of the page in a form that is editable normally "[[Template:Name]]" after you have saved your text.
  • {{msgnw:Name}} when the page containing it is fetched, includes the template in a form that displays it as raw wiki syntax, like <nowiki> does

Using parameters in templates

Template with numbered parameters
 
'''A little thank you...'''<br>
<small>for {{{1}}}.<br>
hugs, {{{2}}}</small>
You type You get
{{Thankyou|all your hard work|Joe}}
Example sunflower image
A little thank you...
for all your hard work.
hugs, Joe
with named parameters
 
'''A little thank you...'''<br>
<small>for {{{reason}}}.<br>
hugs, {{{signature}}}</small>
You type You get
{{Thankyou
|reason=all your hard work
|signature=Joe}}
Example sunflower image
A little thank you...
for all your hard work.
hugs, Joe

You can define parameters in templates either numbered as {{{1}}} or named {{{param}}}.

Example: You want a little thank you note you can put on the talk page of other users. It will contain a reason and your signature. You could create Template:Thankyou to enter your text, as in the example in the table.

When using the template on a page, you fill in the parameter values, separated by a pipe char (|): {{Thankyou|all your hard work|Joe}}. For named parameters use "name=value" pairs separated by a pipe char: {{Thankyou|reason=all your hard work|signature=Joe}}. The advantage of using named parameters in your template is that they are flexible in order. It also makes the template easier to understand if you have many parameters. If you want to change the order of numbered parameters, you have to mention them explicitly: {{Thankyou|2=Joe|1=all your hard work}}.

You can also provide default values for parameters, i.e. values that are going to be used if no value is provided for a parameter. For example, {{{reason|all your hard work}}} would result in "all your hard work" if no value was provided for the parameter reason.

Control template inclusion

You can control template inclusion by the use of <noinclude> and <includeonly> tags.

Anything between <noinclude> and </noinclude> will be processed and displayed only when the page is being viewed directly, not included.

Possible applications are:

  • Categorising templates
  • Interlanguage links to similar templates in other languages
  • Explanatory text about how to use the template

The converse is <includeonly>. Text between <includeonly> and </includeonly> will be processed and displayed only when the page is being included. The obvious application is to add all pages containing a given template to a category, without putting the template itself into that category.

Template:Note when you change the categories applied by a template, the categorization of the pages that use that template may not be updated until some time later: this is handeled by the job queue.

Organizing templates

For templates to be effective users need to find them and be able to use them. A simple technique is to include an example on the template page. For example:

<noinclude>
==Usage==
Allows to establish a link to a subject:
{{NameOfTemplate|Term1+Term2+Term3}}
</noinclude>

Then, an editor can simply copy and paste the example to create a similar page.

See Also

External links

MetaWiki: Help:Template

>== Template == <onlyinclude><div class="LanguageLinks"> <table width="100%"> <tr valign="top" style="background: #EEF3E2"> <td style="width: 25px; padding-left: 0.5em;">Languages</td> <td style="width: 10px; white-space: nowrap; padding: 4px 1em 0 0.5em; border-right: 1px solid #aaaaaa;">Languages:&nbsp;</td><td style="padding: 1px 1em 0; background: #F6F9ED;"> English {{#ifexist: {{#if: Help:Templates | Help:Templates | {{#if: Help | Help:}}Templates}}/ar |  • {{#if: Help:Templates|العربية| العربية}}|}} {{#ifexist: {{#if: Help:Templates | Help:Templates | {{#if: Help | Help:}}Templates}}/br |  • {{#if: Help:Templates|Brezhoneg| Brezhoneg}}|}} {{#ifexist: {{#if: Help:Templates | Help:Templates | {{#if: Help | Help:}}Templates}}/ca |  • {{#if: Help:Templates|Català| Català}}|}} {{#ifexist: {{#if: Help:Templates | Help:Templates | {{#if: Help | Help:}}Templates}}/cs |  • {{#if: Help:Templates|Česky| Česky}}|}} {{#ifexist: {{#if: Help:Templates | Help:Templates | {{#if: Help | Help:}}Templates}}/de |  • {{#if: Help:Templates|Deutsch| Deutsch}}|}} {{#ifexist: {{#if: Help:Templates | Help:Templates | {{#if: Help | Help:}}Templates}}/el |  • {{#if: Help:Templates|Ελληνικά| Ελληνικά}}|}} {{#ifexist: {{#if: Help:Templates | Help:Templates | {{#if: Help | Help:}}Templates}}/es |  • {{#if: Help:Templates|Español| Español}}|}} {{#ifexist: {{#if: Help:Templates | Help:Templates | {{#if: Help | Help:}}Templates}}/fa |  • {{#if: Help:Templates|فارسی| فارسی}}|}} {{#ifexist: {{#if: Help:Templates | Help:Templates | {{#if: Help | Help:}}Templates}}/fi |  • {{#if: Help:Templates|Suomi| Suomi}}|}} {{#ifexist: {{#if: Help:Templates | Help:Templates | {{#if: Help | Help:}}Templates}}/fr |  • {{#if: Help:Templates|Français| Français}}|}} {{#ifexist: {{#if: Help:Templates | Help:Templates | {{#if: Help | Help:}}Templates}}/he |  • {{#if: Help:Templates|עברית| עברית}}|}} {{#ifexist: {{#if: Help:Templates | Help:Templates | {{#if: Help | Help:}}Templates}}/hu |  • {{#if: Help:Templates|Magyar| Magyar}}|}} {{#ifexist: {{#if: Help:Templates | Help:Templates | {{#if: Help | Help:}}Templates}}/id |  • {{#if: Help:Templates|Bahasa Indonesia| Bahasa Indonesia}}|}} {{#ifexist: {{#if: Help:Templates | Help:Templates | {{#if: Help | Help:}}Templates}}/it |  • {{#if: Help:Templates|Italiano| Italiano}}|}} {{#ifexist: {{#if: Help:Templates | Help:Templates | {{#if: Help | Help:}}Templates}}/ja |  • {{#if: Help:Templates|日本語| 日本語}}|}} {{#ifexist: {{#if: Help:Templates | Help:Templates | {{#if: Help | Help:}}Templates}}/ko |  • {{#if: Help:Templates|한국어| 한국어}}|}} {{#ifexist: {{#if: Help:Templates | Help:Templates | {{#if: Help | Help:}}Templates}}/mr |  • {{#if: Help:Templates|मराठी| मराठी}}|}} {{#ifexist: {{#if: Help:Templates | Help:Templates | {{#if: Help | Help:}}Templates}}/nl |  • {{#if: Help:Templates|Nederlands| Nederlands}}|}} {{#ifexist: {{#if: Help:Templates | Help:Templates | {{#if: Help | Help:}}Templates}}/no |  • {{#if: Help:Templates|‪Norsk (bokmål)‬| ‪Norsk (bokmål)‬}}|}} {{#ifexist: {{#if: Help:Templates | Help:Templates | {{#if: Help | Help:}}Templates}}/oc |  • {{#if: Help:Templates|Occitan| Occitan}}|}} {{#ifexist: {{#if: Help:Templates | Help:Templates | {{#if: Help | Help:}}Templates}}/pl |  • {{#if: Help:Templates|Polski| Polski}}|}} {{#ifexist: {{#if: Help:Templates | Help:Templates | {{#if: Help | Help:}}Templates}}/pt |  • {{#if: Help:Templates|Português| Português}}|}} {{#ifexist: {{#if: Help:Templates | Help:Templates | {{#if: Help | Help:}}Templates}}/ro |  • {{#if: Help:Templates|Română| Română}}|}} {{#ifexist: {{#if: Help:Templates | Help:Templates | {{#if: Help | Help:}}Templates}}/ru |  • {{#if: Help:Templates|Русский| Русский}}|}} {{#ifexist: {{#if: Help:Templates | Help:Templates | {{#if: Help | Help:}}Templates}}/sq |  • {{#if: Help:Templates|Shqip| Shqip}}|}} {{#ifexist: {{#if: Help:Templates | Help:Templates | {{#if: Help | Help:}}Templates}}/sr |  • {{#if: Help:Templates|Српски / Srpski| Српски / Srpski}}|}} {{#ifexist: {{#if: Help:Templates | Help:Templates | {{#if: Help | Help:}}Templates}}/sv |  • {{#if: Help:Templates|Svenska| Svenska}}|}} {{#ifexist: {{#if: Help:Templates | Help:Templates | {{#if: Help | Help:}}Templates}}/th |  • {{#if: Help:Templates|ไทย| ไทย}}|}} {{#ifexist: {{#if: Help:Templates | Help:Templates | {{#if: Help | Help:}}Templates}}/vi |  • {{#if: Help:Templates|Tiếng Việt| Tiếng Việt}}|}} {{#ifexist: {{#if: Help:Templates | Help:Templates | {{#if: Help | Help:}}Templates}}/yue |  • {{#if: Help:Templates|粵語| 粵語}}|}} {{#ifexist: {{#if: Help:Templates | Help:Templates | {{#if: Help | Help:}}Templates}}/zh |  • {{#if: Help:Templates|中文| 中文}}|}} {{#ifexist: {{#if: Help:Templates | Help:Templates | {{#if: Help | Help:}}Templates}}/zh-hans |  • {{#if: Help:Templates|‪中文(简体)‬| ‪中文(简体)‬}}|}} {{#ifexist: {{#if: Help:Templates | Help:Templates | {{#if: Help | Help:}}Templates}}/zh-hant |  • {{#if: Help:Templates|‪中文(繁體)‬| ‪中文(繁體)‬}}|}} </td></tr></table></div></onlyinclude>



Page Is Unavailable Due To Site Maintenance, Please Visit Reserve Copy Page


CLICK HERE


Syntax

{{{Languages|PageName}}}
  • PageName (optional) - the name of the page to display language links for. If omitted then the English version of the current page is used. This parameter can normally be omitted, as it is only required if you want to link to a page other than the one you place the template on, which is very uncommon. If this parameter is used on a sub-page make sure you supply the root name, not the full page name (e.g. on MediaWiki/fr you would need to use {{{Languages|MediaWiki}}} and not {{{Languages|MediaWiki/fr}}}).

Usage

The template should only be placed on pages that exist in more than one language, and it should be placed in the same location on each translation of the page.

The English version of a page is always the main version, with all other languages as sub-pages, named using the appropriate language code (see below).

For example, on the Main Page you would include the text {{{Languages}}}, both on Main Page itself, and on each of its language sub-pages. The template automatically creates links to any language sub-pages that exist, e.g. Main Page/ja<tt>, <tt>Main Page/fr, and ignores non-existant languages.

See Project:Language policy for further details about translating pages.

Supported languages

This shows you the name of each language's sub-page (using Main Page as an example). Other languages may be added easily as necessary. Please use the appropriate prefix, as used on Wikipedia when adding a new language. Please do not add languages for which no pages exist yet, as this will increase the time needed to include the template without adding any benefit (languages are only displayed to the user when the relevant page exists).

The link on the language names goes to the Wikipedia in that language. If no Wikipedia in your language exists, do not add pages in that language to MediaWiki.org! This wiki is not the place for language advocacy - please go through the correct channels, and once your language has a Wikipedia then please return to add content here.

Page Name Language
Main Page English
Main Page/ar Arabic
Main Page/br Breton
Main Page/ca Catalan
Main Page/cs Czech
Main Page/de German
Main Page/el Greek
Main Page/es Spanish
Main Page/fa Persian
Main Page/fi Finnish
Main Page/fr French
Main Page/he Hebrew
Main Page/hu Hungarian
Main Page/id Indonesian
Main Page/it Italian
Main Page/ja Japanese
Main Page/ko Korean
Main Page/mr Marathi
Main Page/nl Nederlands
Main Page/no Norwegian
Main Page/oc Occitan
Main Page/pl Polish
Main Page/pt Portugese
Main Page/ro Romanian
Main Page/ru Russian
Main Page/sq Albanian
Main Page/sr Serbian
Main Page/sv Swedish
Main Page/th Thai
Main Page/vi Vietnamese
Main Page/yue Cantonese
Main Page/zh Chinese
Main Page/zh-hans Chinese (Simplified)
Main Page/zh-hant Chinese (Traditional)

Example

Here is how the language bar looks on the MediaWiki page: Languages

Personal tools
Noteworthy