Content deleted Content added
GloryRoad66 (talk | contribs) |
that’s a directory now |
||
(43 intermediate revisions by 37 users not shown) | |||
Line 1:
{{Short description|Wikimedia project page or help page}}
{{Wikipedia how to|sort-by=Templates, A quick guide to}}{{Wiki markup}}▼
{{pp-semi-indef|small=yes}}
This is a quick '''overview of templates'''. Full details can be found in '''[[Help:Template]]''' and '''[[m:Help:Advanced templates]]'''.▼
{{pp-move-indef|small=yes}}
▲{{Wikipedia how to|H:TQG|sort-by=Templates, A quick guide to}}{{Wiki markup}}
▲This is a quick '''overview of templates'''. Full details can be found in
A '''template''' is a Wikipedia page created to be included in other pages.
Template pages are found in the [[Wikipedia:Template namespace|template namespace]]. This means any page whose title begins with "Template:", such as "[[Template:foo]]", can be used for that purpose. The content from a template titled Template:foo can be added into a Wikipedia page by editing a page and typing <code><nowiki>{{foo}}</nowiki></code> into it. When then viewing the page, <code><nowiki>{{foo}}</nowiki></code> is automatically replaced by the content of the page "Template:foo". If the page "Template:foo" is later altered, all the pages with <code><nowiki>{{foo}}</nowiki></code> in them will change automatically.
Line 11 ⟶ 13:
When a template is automatically expanded and appears on a page, it is said to be "[[Wikipedia:Transclusion|transcluded]]".
[[Wikipedia:Template documentation|Templates are documented]] (or should be) at their pages. Thus if you want to know how to use a template whose name is "foo" (perhaps because you've seen <code><nowiki>{{foo|...}}</nowiki></code> in the source of an article), then go to "Template:foo". (The documentation itself will usually be located at "Template:foo/doc", but is also transcluded onto the "Template:foo" main page
==Creating, editing, and using templates==
Line 22 ⟶ 24:
If the template that you want to edit looks like <code><nowiki>{{foo}}</nowiki></code>, you would go to Template:foo to edit it. To get there, type "Template:foo" in the search box (see [[Help:Searching|search]]), or make a wikilink like <code><nowiki>[[Template:foo]]</nowiki></code> somewhere, such as in the [[{{ns:4}}:sandbox|sandbox]], and click on it.
Once you are there, just click "edit" or "edit this page" at the very top of the page (not the documentation edit button lower down) and edit it in the same way that you would any other page. You can add anything that you would add to a normal page, including text, images, and other templates. When editing templates that are
===Parameters===
Templates can have parameters which the page can dynamically incorporate into the transcluded page. Instead of just the template name, like <code><nowiki>{{foo}}</nowiki></code>, an embedded template tag would have additional values separated by [[vertical bar]]s (|), e.g. <code><nowiki>{{foo|July|lc=yes}}</nowiki></code>. Here <code>July</code> is the value of the first unnamed parameter; <code>yes</code> is the value of the named parameter <code>lc</code>. Writing the template page for a template with parameters is more complicated than for a template with no parameters. See [[Help:Template]].
===Editing existing templates===
When you edit a template that is in use, it can affect many pages throughout Wikipedia all at once.
{{slink|Wikipedia:Template editor|Use}} has tips to help avoid problems.
== Template link template==
To include the actual full name of the template as text (including the surrounding braces) in a Wikipedia article, apply the [[template:template link|'''template link''' template]].
::<code><nowiki>{{tl|foo}}</nowiki></code>
Line 35 ⟶ 42:
==FAQ==
; How can I find out how to use an existing template?
: To see the documentation for the template whose name is "foo", go to "Template:foo". ;Can I use a template in more than one project? : No, if you want to use it on two different language Wikipedias, for example, you would need to create it twice.▼
; How do I find out where a template is used?
: To list all pages onto which a template is transcluded, use '''[[Special:WhatLinksHere]]''' and type in template:''templatename'' ([[Help:What links here|more info]]).
; How can I add parameters? : See [[Help:Template]] for instructions.▼
; I edited the template, so why didn't the page it is used on change? : Wikipedia and your computer both store webpage ''[[Web cache|caches]]'' – or saved copies – and don't always show you an updated page. First, try to [[WP:BYPASS|bypass your browser's cache]] by pressing ⌘R, Ctrl+R, or F5. If that fails, you may need to [[WP:PURGE|purge]] the page's cache (which can be done several different ways). Perhaps the easiest way to do this is by clicking '''edit''' on the page in which the template appears, and then clicking on '''Save page''' without having changed anything – there is no need to fill in the ''Summary'' field since there will not be any ''history'' of this as a change generated.▼
; Can I move a template to a new name? : Yes, this works in exactly the same way as normal [[Help:Moving a page|page moves]]. When a page called for inclusion is a redirect page, the redirect target is included instead.▼
▲
▲; Can I use a template within a template? : Yes.
;How do I add a new template?: You start a new template in the same way you would start a normal page. The only difference is that its title must start with {{code|Template:}}. Don't forget to document it so that other editors can use it!▼
; Are template names case-sensitive?
; Where is the manual for the programming language used to write templates?: The language inside templates is the same language as regular wiki markup, but template writers tend to use the more complex available functions such as #if: statements. See Wikipedia's [[Help:Template]] and Wikimedia's [[mw:Help:Template]], including all of "advanced functioning" help pages listed toward the bottom of [[mw:Help:Template#Links to other help pages|that page]].▼
: Yes, except usually (on most wikis)<sup>[[meta:Help:Template#Case sensitivity|[1]]]</sup> the first letter.
; How can I add parameters?
; I edited the template, so why didn't the page it is used on change?
▲
; Can I move a template to a new name?
▲
; Can I use a template within a template?
: Yes.
; How do I add a new template?
▲
; Where is the manual for the programming language used to write templates?
▲
==Examples==
Line 55 ⟶ 82:
*[[Help:Template]] (more details)
*[[m:Help:Templates]] (details from [[Wikimedia]])
*[[
*[[Wikipedia:Template namespace]] (the usual [[Wikipedia:Namespace|namespace]] for templates)
*[[Wikipedia:Transclusion]] (transcluding templates)
Line 63 ⟶ 90:
{{Help navigation}}
{{Wikipedia technical help|collapsed}}
{{DEFAULTSORT:Quick guide to templates, A}}
|