Help:Template: Difference between revisions

From the Super Mario Wiki, the Mario encyclopedia
Jump to navigationJump to search
mNo edit summary
mNo edit summary
 
(48 intermediate revisions by 12 users not shown)
Line 1: Line 1:
'''Here's how to create and use a template:'''__NOTOC__
As with other wikis, the Super Mario Wiki provides templates that help the user to browse any information quickly and efficiently. See [[MarioWiki:Navigation templates]] and [[MarioWiki:Notice templates]] for more in-depth information about these two major groups of templates.


== Usage ==
==Usage==
First, consider what the template would be used for. What would its purpose be? Some common uses are:
To understand their usage, the templates existing in this wiki are classified in this way:


*A [[:Category:Navigation Templates|navigation]] template
*[[:Category:Content templates|Content templates]] – These templates are used in articles and have a specific use based around a given series, game, console, etc.
*A [[:Category:Notice Templates|notice]] template
*[[:Category:Formatting templates|Formatting templates]] – These templates allow users to change elements of a page quickly by just adding them. Examples are the {{tem|color}} template to change the color of the text and {{tem|ref needed}} the add over a text that lacks a citation to make it valid.
*[[:Category:Image map templates|Image map templates]] – These templates contain an image with links. By clicking on an linked area of the image, the user will be sent to the article in question.
*[[:Category:Infobox templates|Infobox templates]] – These templates contain the essential information about the topic of an article. Examples are {{tem|character infobox}} and {{tem|game infobox}}.
*[[:Category:Navigation templates|Navigation templates]] – These templates has links that are directly or indirectly related to a topic. A good example can be the {{tem|SMG}} template that shows all the elements related to the game ''[[Super Mario Galaxy]]''.
*[[:Category:Notice templates|Notice templates]] – These templates serve to notice readers the current state of a page. Arguably the most used templates found in this category are the {{tem|stub}} and {{tem|upcoming}} templates. The first describes a page or article needs to be deeply developed and the latter talks about a future project, like a new game.
*[[:Category:Project templates|Project templates]] – These templates are used for wiki community and administrative purposes, such as [[The 'Shroom:Main Page|The 'Shroom]].
*[[:Category:Title templates|Title templates]] – These templates are used for modifying or outputting the title of pages.


== Code ==
==Formatting==
Make sure you know the MediaWiki syntax for a template:
Make sure you know the MediaWiki syntax for a template:
*For an input, type '''<nowiki>{{{1}}}</nowiki>''' for the first input, '''<nowiki>{{{2}}}</nowiki>''' for the second, and so on.
**This can also be substituted with '''<nowiki>{{{value}}}</nowiki>''' or another name.
*For current page information, type '''<nowiki>{{NAMESPACE}}</nowiki>''' for the page’s namespace, and '''<nowiki>{{PAGENAME}}</nowiki>''' for the page’s name.
**These will be inserted and changed as the location of the template changes.


Make sure you know how to use the template once it’s been created:
To create a template, it's needed to put the title starting '''Template''' and then the name of the template. Example: '''Template:Name of template'''  
*If the template is in a '''Template:''' namespace, simply type '''<nowiki>{{its name}}</nowiki>''' to use it.
*If the template is in any other namespace, simply type '''<nowiki>{{Namespace:its name}}</nowiki>''' to use it.
*For an input, '''<nowiki>{{{1}}}</nowiki>''', type '''<nowiki>{{its name|input 1|input 2|etc...}}</nowiki>'''.
*For an input, '''<nowiki>{{{value}}}</nowiki>''', type '''<nowiki>{{its name|value = input 1}}</nowiki>'''.


To include text in the template that you don't want to show up in pages that use it, such as:
Add the content you want to show for the template in the edit area. To insert an input, type <tt><nowiki>{{{1}}}</nowiki></tt> for the first input, <tt><nowiki>{{{2}}}</nowiki></tt> for the second, and so on. You can also specify the input by inserting a name like this <tt><nowiki>{{{name}}}</nowiki></tt>.


*Instructions on how to use the template
Once you've finished, it's possible that you have to use the coding <tt><nowiki><includeonly> </includeonly></nowiki></tt> to tag the content of the template that will be shown and <tt><nowiki><noinclude> </noinclude></nowiki></tt> to tag the rest that shouldn't. The Noinclude tag usually covers the usage instructions of the template and the template's category.
*A category to organize the template


Place the text in a set of '''<nowiki><noinclude></nowiki>''' tags at the bottom of the template page.
To embed a template, simply type <tt><nowiki>{{Name of template}}</nowiki></tt> in a page.


=== Substituting ===
If the template is in any other namespace, simply type <tt><nowiki>{{namespace:Name of template}}</nowiki></tt> to use it.
For some templates, it is a better idea to take load off the server and use '''subst:''' before the template name. This substitutes the dynamic code on the page with static text. For example, '''<nowiki>{{tick}}</nowiki>''' will display as '''<nowiki>{{tick}}</nowiki>''' in the code, while '''<nowiki>{{subst:tick}}</nowiki>''' will display as '''<nowiki>[[Image:wiki tick.GIF]]</nowiki>''' in the code.


== Example ==
If the template has inputs, type <tt><nowiki>{{Name of template|write here to change the first parameter of a template|write here to change the second one}}</nowiki></tt>
Here is a simple example, creating a signature for any user typing '''<nowiki>{{Sig|User}}</nowiki>''':
 
If the template has specified inputs, type <tt><nowiki>{{Name of template|name=The name of something}}</nowiki></tt>
 
===Substituting===
In some cases involving more complex coding and template functions, '''subst:''' must be placed before the template name. This substitutes the dynamic code on the page with static text (i.e. the content within the template is pasted on the other page, rather than the template itself). For example, <tt><nowiki>{{tick}}</nowiki></tt> will display as <tt><nowiki>{{tick}}</nowiki></tt> in the code, while <tt><nowiki>{{subst:tick}}</nowiki></tt> will display as <tt><nowiki>[[File:Wiki tick.gif]]</nowiki></tt> in the code, which is what is contained in the <nowiki>{{tick}}</nowiki> template.
 
==Example==
Here is a simple example, creating a signature for any user typing '''<nowiki>{{sig|User}}</nowiki>''':


:If the template contains the code:
:If the template contains the code:
Line 41: Line 44:
:[[User:User|User]] ([[User talk:User|talk]] &middot; [[Special:Contributions/User|edits]])
:[[User:User|User]] ([[User talk:User|talk]] &middot; [[Special:Contributions/User|edits]])


[[Category:Help|{{PAGENAME}}]]
==See also==
*[[MarioWiki:Navigation templates]]
*[[MarioWiki:Notice templates]]
*[[wikipedia:Help:Template|Help:Template on Wikipedia]]
 
{{MarioWiki}}
{{Shortcut|SMW:TEMPLATE}}
[[Category:Help]]

Latest revision as of 13:04, June 5, 2024

As with other wikis, the Super Mario Wiki provides templates that help the user to browse any information quickly and efficiently. See MarioWiki:Navigation templates and MarioWiki:Notice templates for more in-depth information about these two major groups of templates.

Usage

To understand their usage, the templates existing in this wiki are classified in this way:

  • Content templates – These templates are used in articles and have a specific use based around a given series, game, console, etc.
  • Formatting templates – These templates allow users to change elements of a page quickly by just adding them. Examples are the {{color}} template to change the color of the text and {{ref needed}} the add over a text that lacks a citation to make it valid.
  • Image map templates – These templates contain an image with links. By clicking on an linked area of the image, the user will be sent to the article in question.
  • Infobox templates – These templates contain the essential information about the topic of an article. Examples are {{character infobox}} and {{game infobox}}.
  • Navigation templates – These templates has links that are directly or indirectly related to a topic. A good example can be the {{SMG}} template that shows all the elements related to the game Super Mario Galaxy.
  • Notice templates – These templates serve to notice readers the current state of a page. Arguably the most used templates found in this category are the {{stub}} and {{upcoming}} templates. The first describes a page or article needs to be deeply developed and the latter talks about a future project, like a new game.
  • Project templates – These templates are used for wiki community and administrative purposes, such as The 'Shroom.
  • Title templates – These templates are used for modifying or outputting the title of pages.

Formatting

Make sure you know the MediaWiki syntax for a template:

To create a template, it's needed to put the title starting Template and then the name of the template. Example: Template:Name of template

Add the content you want to show for the template in the edit area. To insert an input, type {{{1}}} for the first input, {{{2}}} for the second, and so on. You can also specify the input by inserting a name like this {{{name}}}.

Once you've finished, it's possible that you have to use the coding <includeonly> </includeonly> to tag the content of the template that will be shown and <noinclude> </noinclude> to tag the rest that shouldn't. The Noinclude tag usually covers the usage instructions of the template and the template's category.

To embed a template, simply type {{Name of template}} in a page.

If the template is in any other namespace, simply type {{namespace:Name of template}} to use it.

If the template has inputs, type {{Name of template|write here to change the first parameter of a template|write here to change the second one}}

If the template has specified inputs, type {{Name of template|name=The name of something}}

Substituting

In some cases involving more complex coding and template functions, subst: must be placed before the template name. This substitutes the dynamic code on the page with static text (i.e. the content within the template is pasted on the other page, rather than the template itself). For example, {{tick}} will display as {{tick}} in the code, while {{subst:tick}} will display as [[File:Wiki tick.gif]] in the code, which is what is contained in the {{tick}} template.

Example

Here is a simple example, creating a signature for any user typing {{sig|User}}:

If the template contains the code:
[[User:{{{1}}}|{{{1}}}]] ([[User talk:{{{1}}}|talk]] · [[Special:Contributions/{{{1}}}|edits]])
Typing {{Sig|user}} inserts this code:
[[User:User|User]] ([[User talk:User|talk]] · [[Special:Contributions/User|edits]])
Which shows on the page as:
User (talk · edits)

See also