Difference between revisions of "Help:Template"

Line 1: Line 1:
 +
 +
== Templates ==
 +
 
A template is a page anyone can create.  An example template is [[Template:Stub]].  If someone creates an article that belongs in a certain category, they can add the template name for that category by adding the template name in double brackets at the bottom of the page, like so: {{category name}}.  For example, this page has the the template <nowiki>{{Tutorial}}</nowiki> at the bottom of the page.
 
A template is a page anyone can create.  An example template is [[Template:Stub]].  If someone creates an article that belongs in a certain category, they can add the template name for that category by adding the template name in double brackets at the bottom of the page, like so: {{category name}}.  For example, this page has the the template <nowiki>{{Tutorial}}</nowiki> at the bottom of the page.
 +
 +
 +
== Categories ==
  
 
A category is a page where all articles with a similar theme are listed.  An example is  [[Category:Stubs]].  All articles that were categorized with the <nowiki>{{stub}}</nowiki> formatting will be in this category.  To directly add a page to a category, use the <nowiki>[[Category:Insert Category]]</nowiki> code.  This page, for example, displays the <nowiki>[[Category:AoPSWiki]]</nowiki> code at the bottom.
 
A category is a page where all articles with a similar theme are listed.  An example is  [[Category:Stubs]].  All articles that were categorized with the <nowiki>{{stub}}</nowiki> formatting will be in this category.  To directly add a page to a category, use the <nowiki>[[Category:Insert Category]]</nowiki> code.  This page, for example, displays the <nowiki>[[Category:AoPSWiki]]</nowiki> code at the bottom.
 +
 +
 +
== How to Create a Template ==
  
 
To create a template, which we will call "Sample" for the purposes of this tutorial, first navigate to the page Template:Sample.  Edit the page, then add the following text (anything in bold can be changed):
 
To create a template, which we will call "Sample" for the purposes of this tutorial, first navigate to the page Template:Sample.  Edit the page, then add the following text (anything in bold can be changed):
Line 14: Line 23:
  
 
----
 
----
 +
 +
Now, whenever you add the code <nowiki>{{sample}}</nowiki> at the end of an article, it will display the text "''This article is a sample.  It's purpose is to do this and that and this that.''
 +
Also, the page Category:Samples will be automatically created.  Any pages tagged with <nowiki>{{sample}}</nowiki> will automatically be added to Category:Samples.
 +
 +
  
 
[[Category:AoPSWiki]]
 
[[Category:AoPSWiki]]
 
{{Tutorial}}
 
{{Tutorial}}

Revision as of 12:24, 27 June 2006

Templates

A template is a page anyone can create. An example template is Template:Stub. If someone creates an article that belongs in a certain category, they can add the template name for that category by adding the template name in double brackets at the bottom of the page, like so: Template:Category name. For example, this page has the the template {{Tutorial}} at the bottom of the page.


Categories

A category is a page where all articles with a similar theme are listed. An example is. All articles that were categorized with the {{stub}} formatting will be in this category. To directly add a page to a category, use the [[Category:Insert Category]] code. This page, for example, displays the [[Category:AoPSWiki]] code at the bottom.


How to Create a Template

To create a template, which we will call "Sample" for the purposes of this tutorial, first navigate to the page Template:Sample. Edit the page, then add the following text (anything in bold can be changed):


This article is a sample. It's purpose is to do this and that and this that.

<noinclude>''This template will categorize articles that include it into [[:Category:Samples]].''</noinclude>

[[Category:Samples]]


Now, whenever you add the code {{sample}} at the end of an article, it will display the text "This article is a sample. It's purpose is to do this and that and this that. Also, the page Category:Samples will be automatically created. Any pages tagged with {{sample}} will automatically be added to Category:Samples. This article is a tutorial about the AoPSWiki or AoPS Forum.