Help:Template

From Homestar Runner Wiki

(Difference between revisions)
Jump to: navigation, search
(Created Help:Template: The 10th help page.)
(Added subst: information)
Line 16: Line 16:
*For an input, '''<nowiki>{{{1}}}</nowiki>''', type '''<nowiki>{{its_name|input 1|input 2|etc...}}</nowiki>'''.
*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>'''.
*For an input, '''<nowiki>{{{value}}}</nowiki>''', type '''<nowiki>{{its_name|value = input 1}}</nowiki>'''.
-
4. Here is a simple example, creating a signature for any user typing '''<nowiki>{{Sig|User}}</nowiki>''':
+
 
 +
4. 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.
 +
 
 +
5. Here is a simple example, creating a signature for any user typing '''<nowiki>{{Sig|User}}</nowiki>''':
<pre>[[User:{{{1}}}|{{{1}}}]] ([[User talk:{{{1}}}|talk]] &middot; [[Special:Contributions/{{{1}}}|edits]])</pre>
<pre>[[User:{{{1}}}|{{{1}}}]] ([[User talk:{{{1}}}|talk]] &middot; [[Special:Contributions/{{{1}}}|edits]])</pre>

Revision as of 20:28, 13 November 2005

Here's how to create and use a template:

1. First, consider what the template would be used for. What would its purpose be? Some common uses are:

2. Make sure you know the MediaWiki syntax for a template:

  • For an input, type {{{1}}} for the first input, {{{2}}} for the second, and so on.
    • This can also be substituted with {{{value}}} or another name.
  • For current page information, type {{NAMESPACE}} for the page’s namespace, and {{PAGENAME}} for the page’s name.
    • These will be inserted and changed as the location of the template changes.

3. Make sure you know how to use the template once it’s been created:

  • If the template is in a Template: namespace, simply type {{its_name}} to use it.
  • If the template is in any other namespace, simply type {{Namespace:its_name}} to use it.
  • For an input, {{{1}}}, type {{its_name|input 1|input 2|etc...}}.
  • For an input, {{{value}}}, type {{its_name|value = input 1}}.

4. 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, {{tick}} will display as {{tick}} in the code, while {{subst:tick}} will display as [[Image:wiki_tick.GIF]] in the code.

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

[[User:{{{1}}}|{{{1}}}]] ([[User talk:{{{1}}}|talk]] · [[Special:Contributions/{{{1}}}|edits]])

Produces:

[[User:User|User]] ([[User talk:User|talk]] • [[Special:Contributions/User|edits]])

Which looks like: User (talkedits)

Personal tools