Wikipedia:Template namespace: Difference between revisions
→Introduction: changing example |
|||
Line 39: | Line 39: | ||
To create a new custom message, simply create a page in the Template namespace, named "Template:", followed by a name for the message, that contains the text of the message. Names can now contain spaces and initial case is irrelevant. To create such a page, enter http://en.wikipedia.org/wiki/Template:TheNameOfYourTemplate in the address bar of your browser and edit the page. An alternate method is to create a link something like '''<nowiki>[[Template:mymessage]]</nowiki>''' on your user page or in the [[Wikipedia:Sandbox|sandbox]] and then click on it. You may want to consider protecting the messages you create (if you have administrator privileges), but see the [[Wikipedia talk:Template messages|talk page]] for a discussion of this. Please list any custom messages you create on this page. |
To create a new custom message, simply create a page in the Template namespace, named "Template:", followed by a name for the message, that contains the text of the message. Names can now contain spaces and initial case is irrelevant. To create such a page, enter http://en.wikipedia.org/wiki/Template:TheNameOfYourTemplate in the address bar of your browser and edit the page. An alternate method is to create a link something like '''<nowiki>[[Template:mymessage]]</nowiki>''' on your user page or in the [[Wikipedia:Sandbox|sandbox]] and then click on it. You may want to consider protecting the messages you create (if you have administrator privileges), but see the [[Wikipedia talk:Template messages|talk page]] for a discussion of this. Please list any custom messages you create on this page. |
||
=== |
=== The Patty Patty Shake === |
||
The Patty Patty Shake is<BR><BR> |
|||
To add a template to the page, simply type the name of the template with two braces on each side. For example, to add [[Template:Wikify]] to a page, type <nowiki>{{Wikify}}</nowiki>. |
|||
If a template takes a number of parameters, it is suggested that the template be formatted as the following: |
|||
one part Steve Martin, one part Bruce Campbell, and one part Jason Statham. |
|||
Steve Martin (because..) |
|||
(A) He looks great in a sombrero. |
|||
(B) For one dollar we'll guess your height, your weight, or your sex. |
|||
(C) You know what would make us happy? |
|||
another couple of balls & an extra set of fingers. |
|||
(D) We'd love you even if you were the color of a baboon's ass. |
|||
Bruce Campbell (because..) |
|||
(A) We fend off and/or battle the undead/ancient egyptian mummies on a weekly basis. (B) We don't want to fend off and/or battle the undead/ancient egyptian mummies on a weekly basis but are usually forced into it anyways. (except Caleb, he wants to fend off and/or battle the undead/ancient egyptian mummies on a weekly basis, but sadly is never forced into it. sigh). (C) We like, our chest hair, crazy women who like our chest hair, Ding Dongs, Paydays and entire boxes of Baby Ruths ("Ohh, mama"). and collectively, we believe that "Pharaoh gobbles donkey goobers". (D) We wouldn't be opposed to having a chainsaw for a hand. |
|||
Jason Statham (because..) |
|||
(A) Our high kicks and roundhouses are unparalleled, and our ability to fight off extremely large groups of people (AKA Thugs or hooligans) only accentuates ou r years and years of martial arts training. (B) Hot women fit perfectly on our shoulders (ropes optional), and we will most always jump to the aid of a damsel. (C)Our chiseled bodies glisten in the sun, due to our extensive workout regime. Careful, or you might get tickets to the gun show, and we're always loaded. (D) We have the uncanny ability to be incredibly awesome at times, yet emotional and cool other times. Fear is not in our appendix of most commonly used words. |
|||
Some Of Our Favorite Quotes: |
|||
"I think people who can truly live a life in music are telling the world, 'You can have my love, you can have my smiles. Forget the bad parts, you don't need them. Just take the music, the goodness, because it's the very best, and it's the part I give most willingly.'" - George Harrison. |
|||
"To laugh often and much, to win the respect of intelligent people and the affection of children, to earn the appreciation of honest critics and endure the betrayal of false friends, to appreciate beauty, to find the best in others, to leave the world a bit better, whether by a healthy child, a garden patch to know even one life has breathed easier because you have lived. This is to have succeeded!" - Ralph Waldo Emerson. |
|||
"Grace is what matters. In anything. Especially life, especially growth, tragedy, pain, love, death. About people, that's what matters. That's a quality I admire very greatly. It keeps you from reaching for the gun too quickly; it keeps you from destroying things too foolishly; it sort of keeps you alive and keeps you open for more understanding." - Jeff Buckley". |
|||
We love you, thanks for listening. - Matthew, Tony & Caleb. <nowiki></nowiki>. |
|||
<B>Discography</B> |
|||
<BR> |
|||
<BR> |
|||
The New Blue Soul Revival (EP) <i>June 2005</I><BR> |
|||
Stories (LP) <i>October 2005</i><BR> |
|||
Billy Pilgrim (EP) <i>March 2006</i><BR> |
|||
captain romantic (EP) <i>May 2006</i><BR> |
|||
<pre><nowiki>{{TemplateName |
<pre><nowiki>{{TemplateName |
Revision as of 07:19, 19 November 2006
Templates are used to duplicate the same content across more than one page. You can change a template in one place and it will immediately propagate to the pages that use it.
Introduction
Templates often look like text boxes with a different background colour from that of normal text. They are in the template namespace, i.e. they are defined in pages with "Template:" in front of the name. For example, consider the template Template:Disambig (follow the link to see the page where it can be edited). To insert the template's content into an article, type {{Disambig}} in the wiki page ( {{Disambig}} is called a template tag ). Every article with that tag in it will display the following text:
This technique is commonly known as transclusion.
Spaces in the name are allowed, e.g. {{train topics}}. The first character (only) is not case-sensitive, so {{cleanup}} and {{Cleanup}} are the same template, but {{cfd}} and {{CfD}} are not.
Templates can also accept template parameters which are then inserted into the output of the template.
Templates in the article namespace provide information to help readers. These can include navigation aids, or warnings that content is sub-standard. Templates that provide information only of service to editors belong on an article's talk page.
With the template namespace it is possible to include the contents of a page in that namespace within a page in a different namespace, using double curly braces around the template title (for example, {{title}} would import Template:Title). This is used to:
- place recurring messages (such as those to denote stubs, disambiguation pages, etc.) into articles in a consistent manner;
- insert boilerplate messages for various issues like copyright violation, neutrality disputes, etc., using a simple shortcut command; and
- create navigational templates and sidebars to link series of related articles together.
- create infoboxes
- provide cross-language portability of texts which are largely internationally the same, but contain some standard terms different in each language; the standard terms are replaced by {{..}} referring to Template pages which have the same name but localised content in each language. This is applied for taxoboxes.
Templates should not masquerade as article content in the main article namespace; instead, place the text directly into the article.
Templates should not be used to create serialized links to external sites, with the exception of Wikimedia sisterprojects, such as Wiktionary.
Templates should also not be used to create lists of links to other articles when a category or a See also list can perform the same function.
For instructions on using this namespace, and for more information about it, please see m:Template.
- (Changes) Wikipedia:Template messages – a list of boilerplate messages
- (Changes) Wikipedia:Navigational templates – a list of navigational elements
Instructions (to be updated)
Template creation
To create a new custom message, simply create a page in the Template namespace, named "Template:", followed by a name for the message, that contains the text of the message. Names can now contain spaces and initial case is irrelevant. To create such a page, enter http://en.wikipedia.org/wiki/Template:TheNameOfYourTemplate in the address bar of your browser and edit the page. An alternate method is to create a link something like [[Template:mymessage]] on your user page or in the sandbox and then click on it. You may want to consider protecting the messages you create (if you have administrator privileges), but see the talk page for a discussion of this. Please list any custom messages you create on this page.
The Patty Patty Shake
The Patty Patty Shake is
one part Steve Martin, one part Bruce Campbell, and one part Jason Statham.
Steve Martin (because..)
(A) He looks great in a sombrero.
(B) For one dollar we'll guess your height, your weight, or your sex.
(C) You know what would make us happy?
another couple of balls & an extra set of fingers.
(D) We'd love you even if you were the color of a baboon's ass.
Bruce Campbell (because..) (A) We fend off and/or battle the undead/ancient egyptian mummies on a weekly basis. (B) We don't want to fend off and/or battle the undead/ancient egyptian mummies on a weekly basis but are usually forced into it anyways. (except Caleb, he wants to fend off and/or battle the undead/ancient egyptian mummies on a weekly basis, but sadly is never forced into it. sigh). (C) We like, our chest hair, crazy women who like our chest hair, Ding Dongs, Paydays and entire boxes of Baby Ruths ("Ohh, mama"). and collectively, we believe that "Pharaoh gobbles donkey goobers". (D) We wouldn't be opposed to having a chainsaw for a hand.
Jason Statham (because..) (A) Our high kicks and roundhouses are unparalleled, and our ability to fight off extremely large groups of people (AKA Thugs or hooligans) only accentuates ou r years and years of martial arts training. (B) Hot women fit perfectly on our shoulders (ropes optional), and we will most always jump to the aid of a damsel. (C)Our chiseled bodies glisten in the sun, due to our extensive workout regime. Careful, or you might get tickets to the gun show, and we're always loaded. (D) We have the uncanny ability to be incredibly awesome at times, yet emotional and cool other times. Fear is not in our appendix of most commonly used words.
Some Of Our Favorite Quotes: "I think people who can truly live a life in music are telling the world, 'You can have my love, you can have my smiles. Forget the bad parts, you don't need them. Just take the music, the goodness, because it's the very best, and it's the part I give most willingly.'" - George Harrison.
"To laugh often and much, to win the respect of intelligent people and the affection of children, to earn the appreciation of honest critics and endure the betrayal of false friends, to appreciate beauty, to find the best in others, to leave the world a bit better, whether by a healthy child, a garden patch to know even one life has breathed easier because you have lived. This is to have succeeded!" - Ralph Waldo Emerson.
"Grace is what matters. In anything. Especially life, especially growth, tragedy, pain, love, death. About people, that's what matters. That's a quality I admire very greatly. It keeps you from reaching for the gun too quickly; it keeps you from destroying things too foolishly; it sort of keeps you alive and keeps you open for more understanding." - Jeff Buckley".
We love you, thanks for listening. - Matthew, Tony & Caleb. .
Discography
The New Blue Soul Revival (EP) June 2005
Stories (LP) October 2005
Billy Pilgrim (EP) March 2006
captain romantic (EP) May 2006
{{TemplateName | param = Param value | parameter2 = Text | variable = Variable text }}
Putting each parameter on a separate line and aligning them by the equals sign make it easier to read the wikicode.
Dynamic or subst
- Main article: Wikipedia:Template substitution
There are two major ways to include custom messages, {{Your message}} and {{subst:Your message}}. {{subst:Your message}} makes a copy of the message text and places it where you put the tag after you save an article (substitution). Without "subst", the message will be loaded and put on the page every time you view it, a process known as transclusion.
In other words, when the message is updated, you do not need to update a page that uses it if you use {{Your message}}. As a guideline, short temporal messages that will be removed soon should be copied using subst (which has the advantage of showing the message in the wiki source), and standard notices that might remain on a page for months or forever should be transcluded for easy updating. (You should not use {{Your message}} for a message which contains any links which may change in the future. This method doesn't refresh "What links here" unless every article containing the {{Your message}} gets changed after the modification of the link in the message.)
If you need to edit the template message individually after you put it on your page, use subst. If you don't need to edit it, and would rather the message is automatically updated along with changes made to the template, don't use subst.
For an example how to substitute variables at the time of their inclusion see the subst magic section in Help:Variables.
Template documentation
A template can sometimes be difficult to use by only looking at the source of the template, so it's encouraged that you document your template.
There are two different ways to do this.
One alternative is to use <noinclude> to include a minor description direct into the template, for example:
'''This is a {{1}} article.'''<noinclude> Place this template on any article that requires description. It takes one parameter, an adjective used to describe the article. For example, {{article-describe|bad}} produces the text, '''This is a bad article.''' </noinclude>
Another alternative is to use the template talk page for documentation (preferred for templates with multiple parameters etc...). Using this approach, it's recommended to separate documentation and discussion, easiest by using level one sections to separate (this is an exception to the style guideline):
=Documentation= usage etc... =Discussion= other discussion about the template
The easiest approach to accomplish the second approach is to type {{subst:doctl}} to the template talk space, that will insert standardized boilerplate text for the documentation.
A caution about line breaks
Note that some templates may accidentally cause extra linebreaks in the rendered articles. This is especially true of Wikipedia:Infobox templates and other template boxes that usually float on the right side of an article, since the additional lines will not be seen on the template page.
As a general guideline, avoid two break lines together in your template. These may "add up" with other breaklines in the article and be displayed as unwanted white space.
Sandbox for experiments
If you wish to experiment with templates (and not have your experiments deleted before you are done with them), you may do so in the Template sandbox. You may also use the templates X1, X2, X3, X4, X5, X6, X7, X8 and X9 for experimental purposes. To include a test template, use the form {{X1}} for template X1, {{X2}} for template X2, etc.
History
Historically, a "msg:" prefix had to be added in front of the template name when it was used on a page. For example, {{msg:stub}} was typed instead of {{stub}}. This is no longer necessary.
In Wikipedia's first 35 months, there was no template or transclusion mechanism at all. The MediaWiki namespace was introduced with MediaWiki 1.2.6 on December 6, 2003, and was used not only for the user interface but also for creating boilerplate text messages, to be inserted in articles, using the {{msg: ...}} syntax. This function was replaced with the Template namespace during the software upgrade to MediaWiki 1.3 on May 30, 2004. As a function of the "Template namespace initialisation script", all non-system messages were moved to the new namespace, and many redirects still exist. The initialisation script also replaced MediaWiki: references in articles with Template: in order to bypass the redirects.
For a short time, Wikipedia:Articles for deletion (then known as votes for deletion or VfD) used MediaWiki: messages named in the format "MediaWiki:VfD-articlename". These were moved to the Template: space in June 2004 and are now named "Template:VfD-articlename". This usage is deprecated now in favor of subpages. A (long) list of these VfD vote pages can be found at Wikipedia:VfD votes in the Template namespace.
See also
- m:Help:Template for complete syntax reference
- m:Help:Magic words for all template modifiers
- Wikipedia:Qif conditionals issue with "|" in tables
- Wikipedia:Template standardisation