Iron Chariots Wiki:Templates

(Difference between revisions)
Jump to: navigation, search
({subst:stub} in example so this page doesn't appear in Stubs category)
(rewriting parts; some expansion; back later to create subpages listing existing templates)
Line 1: Line 1:
'''Templates''' are reusable portions of text and/or [[WikimediaMeta:Help:Help:Wikitext examples|wiki code]] that can be "included" in other pages by using the "double-braces" wiki syntax:
+
'''Templates''' are reusable portions of text and/or [[WikimediaMeta:Help:Help:Wikitext examples|wiki markup]] that can be "included" in other pages by using the "double-braces" wiki syntax:
 
: <tt><nowiki>{{</nowiki>''Name of template''}}</tt>
 
: <tt><nowiki>{{</nowiki>''Name of template''}}</tt>
The name of the template can have spaces (you don't have to replace them by _underscores_). The contents of the template is stored in the same-named page in the [[Project:Namespace|'''Template:''' namespace]], which would be linked to using the following "double-square-brackets" syntax:
+
The name of the template can have spaces (you don't have to replace them by _underscores_); the first letter is case insensitive (it can be capital or lower-case), but subsequent letters are case sensitive.
 +
 
 +
The ''content'' of the template is stored in the same-named page in the '''Template:''' [[Project:Namespace|namespace]], which would be linked to using the following "double-square-brackets" syntax:
 
: <tt><nowiki>[[Template:</nowiki>''Name of template'']]</tt>
 
: <tt><nowiki>[[Template:</nowiki>''Name of template'']]</tt>
The two forms differ in that the former results in the substitution of the ''contents of'' the template page at that point in the current page (where <nowiki>{{...}}</nowiki> appears), whereas the latter simply ''links to'' the page.
+
The two forms differ in that the former results in the substitution (or "transclusion") of the ''contents of'' the template page at that point in the current page (where <nowiki>{{...}}</nowiki> appears), whereas the latter simply ''links to'' the page.
 +
 
 +
== Wiki markup for templates ==
  
 
A concrete example:
 
A concrete example:
* <tt><nowiki>[[Template:</nowiki>Stub]]</tt> results in the link [[Template:Stub]].
+
* <tt><nowiki>[[Template:</nowiki>Stub]]</tt> results in the link:
 +
*: [[Template:Stub]]
 
* <tt><nowiki>{{Stub}}</nowiki></tt> &mdash; or, equivalently, <tt><nowiki>{{stub}}</nowiki></tt> &mdash; results in the ''contents'' of the "Stub" template being inserted into the current page:
 
* <tt><nowiki>{{Stub}}</nowiki></tt> &mdash; or, equivalently, <tt><nowiki>{{stub}}</nowiki></tt> &mdash; results in the ''contents'' of the "Stub" template being inserted into the current page:
 
*: ''This article is a [[:Category:Stubs|stub]]. You can help out by '''<span class="plainlinks">[{{fullurl:{{FULLPAGENAME}}|action=edit}} expanding it]</span>'''.''
 
*: ''This article is a [[:Category:Stubs|stub]]. You can help out by '''<span class="plainlinks">[{{fullurl:{{FULLPAGENAME}}|action=edit}} expanding it]</span>'''.''
Line 14: Line 19:
 
* <tt><nowiki>[[Stub]]</nowiki></tt> links to the "article" [[Stub]], which itself is a [[WikimediaMeta:Help:Redirect|redirect]] to [[:Category:Stubs]]
 
* <tt><nowiki>[[Stub]]</nowiki></tt> links to the "article" [[Stub]], which itself is a [[WikimediaMeta:Help:Redirect|redirect]] to [[:Category:Stubs]]
 
Note that <tt><nowiki>[[Stub]]</nowiki></tt> and <tt><nowiki>{{Stub}}</nowiki></tt> have nothing to do with each other.
 
Note that <tt><nowiki>[[Stub]]</nowiki></tt> and <tt><nowiki>{{Stub}}</nowiki></tt> have nothing to do with each other.
 +
 +
== Transclusion of content from other namespaces ==
  
 
If you want to insert the contents of an article in the "[[Project:Namespaces|main namespace]]" into another page (this should rarely be done in practice), add a colon immediately after the opening double-braces:
 
If you want to insert the contents of an article in the "[[Project:Namespaces|main namespace]]" into another page (this should rarely be done in practice), add a colon immediately after the opening double-braces:
 
* <tt><nowiki>[[:List of atheist websites]]</nowiki></tt> would link to [[List of atheist websites]]
 
* <tt><nowiki>[[:List of atheist websites]]</nowiki></tt> would link to [[List of atheist websites]]
 
* <tt><nowiki>{{:List of atheist websites}}</nowiki></tt> would insert the contents of [[List of atheist websites]], '''not''' [[Template:List of atheist websites]]
 
* <tt><nowiki>{{:List of atheist websites}}</nowiki></tt> would insert the contents of [[List of atheist websites]], '''not''' [[Template:List of atheist websites]]
'''''Please note:''''' ''Although this feature exists, it probably shouldn't be used on this wiki.''
+
'''''Please note:''''' ''Although this feature exists, it probably shouldn't be used in articles on this wiki.''
  
If the text in braces starts with a [[Project:Namespaces|namespace prefix]], then the contents of ''that'' page will be "included" instead of a page in the '''Template:''' namespace:
+
If the text in braces starts with a [[Project:Namespaces|namespace prefix]], then the contents of ''that'' page will be transcluded instead of a page in the '''Template:''' namespace:
 
* <tt><nowiki>[[Project:Interwiki map (custom)]]</nowiki></tt> links to [[Project:Interwiki map|our custom interwiki map]]
 
* <tt><nowiki>[[Project:Interwiki map (custom)]]</nowiki></tt> links to [[Project:Interwiki map|our custom interwiki map]]
 
* <tt><nowiki>{{Project:Interwiki map (custom)}}</nowiki></tt> inserts our custom interwiki map into a page (this is done on the page [[Project:Interwiki map]], for example)
 
* <tt><nowiki>{{Project:Interwiki map (custom)}}</nowiki></tt> inserts our custom interwiki map into a page (this is done on the page [[Project:Interwiki map]], for example)
  
 
See [[WikimediaMeta:Help:Template]] for more (much, much more) information.
 
See [[WikimediaMeta:Help:Template]] for more (much, much more) information.
 +
 +
== Lists of templates ==
 +
 +
The following pages list the templates that are currently in use on this wiki, including brief descriptions and examples of usage.
 +
* [[Project:Templates/Maintenance|Templates/Maintenance]] &mdash; templates for marking pages in need of attention (deletion, cleanup, etc.)
 +
* [[Project:Templates/Stub|Templates/Stub]] &mdash; templates for marking short, underdeveloped articles on various topics
 +
* [[Project:Templates/Navigation|Templates/Navigation]] &mdash; templates for interlinking many articles on the same subject (e.g., episodes of a TV/video series)
 +
* [[Project:Templates/External|Templates/External]] &mdash; templates for easy linking to external wikis and other websites (see also [[Project:Interwiki map]])
 +
* [[Project:Templates/Utility|Templates/Utility]] &mdash; technical templates used mainly to make other templates
 +
* [[Project:Templates/Other|Templates/Other]] &mdash; all other kinds of templates
  
 
[[Category:Iron Chariots|Templates]]
 
[[Category:Iron Chariots|Templates]]

Revision as of 18:31, 6 February 2007

Templates are reusable portions of text and/or wiki markup that can be "included" in other pages by using the "double-braces" wiki syntax:

{{Name of template}}

The name of the template can have spaces (you don't have to replace them by _underscores_); the first letter is case insensitive (it can be capital or lower-case), but subsequent letters are case sensitive.

The content of the template is stored in the same-named page in the Template: namespace, which would be linked to using the following "double-square-brackets" syntax:

[[Template:Name of template]]

The two forms differ in that the former results in the substitution (or "transclusion") of the contents of the template page at that point in the current page (where {{...}} appears), whereas the latter simply links to the page.

Wiki markup for templates

A concrete example:

  • [[Template:Stub]] results in the link:
    Template:Stub
  • {{Stub}} — or, equivalently, {{stub}} — results in the contents of the "Stub" template being inserted into the current page:
    This article is a stub. You can help out by expanding it.

The latter form, by the way, is how you can mark extremely short articles ("stubs") that need the attention of other editors.

On the other hand:

Note that [[Stub]] and {{Stub}} have nothing to do with each other.

Transclusion of content from other namespaces

If you want to insert the contents of an article in the "main namespace" into another page (this should rarely be done in practice), add a colon immediately after the opening double-braces:

Please note: Although this feature exists, it probably shouldn't be used in articles on this wiki.

If the text in braces starts with a namespace prefix, then the contents of that page will be transcluded instead of a page in the Template: namespace:

See WikimediaMeta:Help:Template for more (much, much more) information.

Lists of templates

The following pages list the templates that are currently in use on this wiki, including brief descriptions and examples of usage.

Personal tools
Variants
Actions
wiki navigation
IronChariots.Org
Toolbox