Difference between revisions of "Help:Template"

ADVERTISEMENT
From Diablo Wiki
Jump to: navigation, search
 
 
Line 3: Line 3:
  
 
== What is a Template? ==
 
== What is a Template? ==
A wiki template is instead an article, just like any other, but with the ability to be 'transcluded' onto other pages. This means that if you have made a table with links for all things concerning a given subject, that could be good for navigating, you can take that table, put it into a template, and then just use a wiki template shortcut to transclude that navigation box on all related articles.
 
  
Other uses of the template can be to just add automatic formatting such as styles or classes to text, similar to how CSS works. It could also be a table of stats from the game, which you might want on more than one page.
 
  
In some cases, templates can be used with variables, and inside other templates. It might look quite complex, and you shouldn't edit what you don't grasp yourself, but they often save a lot of time in the end, as that work needs not to be re-done again, and can easily be edited on all pages the item is shown.
+
A Template is an article, just like any other, but it can be automatically pulled into other pages.  This is usually for a piece of text or set of links that will appear in multiple places but could be subject to changes.  It'll save you creating the text each time you need to use it and updating it on every page it's used on when it does change.
 +
 
 +
'''For example''', using <nowiki>{{Template:Level_navbox}}</nowiki> will insert the following on to page:
 +
 
 +
 
 +
{{Template:Level_navbox}}
 +
 
 +
 
 +
If you ever want to add or change links in that navigation box you simply edit the template, then every page it is used on will display the updated navigation box. Without using a Template you would have had to change every single page, one at a time.
 +
 
 +
 
 +
==How do I edit a Template?==
 +
 
 +
There are two ways:
 +
 
 +
* In the case of navigation boxes the little '''e''' next to the title of the box will take you straight to edit.
 +
* Find the name of the template by hitting '''edit''' on the page and you'll find, as in the case above, <nowiki>{{Template:Level_navbox}}</nowiki> then you can locate that template in the [[:Category:Templates|Template Category]] and click to go to it and edit it from there.
  
  
 
== How does it work?==
 
== How does it work?==
In order to create a template, you start a new article, and naming it like this: [[:Template:New Template]]. All the content in that article will then be easily transcluded to any other page through using the code to call it in: <nowiki>{{New Template}}</nowiki>. That template article content will then replace the "<nowiki>{{New Template}}</nowiki>" snippet. Check our [[{{WikiTitle}}:Policy|title naming policies]] for further help.
+
 
 +
In order to create a template, you start a new article, and name it like this: [[:Template:New Template]]. All the content in that article will then be easily included in any other page through using the code to call it in:  
 +
 
 +
<nowiki>{{New Template}}</nowiki>.
 +
 
 +
 
 +
That template article content will then replace the "<nowiki>{{New Template}}</nowiki>" snippet. Check our [[{{WikiTitle}}:Policy|title naming policies]] for further help.
 +
 
  
 
== Template features ==
 
== Template features ==
 +
 
Templates work like any other wiki page, and you can use any formatting that you can use elsewhere. In addition, there are two tags you can use for your template:
 
Templates work like any other wiki page, and you can use any formatting that you can use elsewhere. In addition, there are two tags you can use for your template:
 +
 
* '''<nowiki><includeonly></includeonly></nowiki>'''
 
* '''<nowiki><includeonly></includeonly></nowiki>'''
 
* '''<nowiki><noinclude></noinclude></nowiki>'''
 
* '''<nowiki><noinclude></noinclude></nowiki>'''
  
Everything you mark to "includeonly" will only be shown on the page where you call it from. Anything outside of this tag will not show on the transcluding page. The "noinclude" works opposite, and anything written in that tag will be shown only on the actual template page ([[:Template:New Template]], for example).
+
Everything you mark to "includeonly" will only be shown on the page where you call it from. Anything outside of this tag will not show on the including page. The "noinclude" works opposite, and anything written in that tag will be shown only on the actual template page ([[:Template:New Template]], for example).
  
 
The "noinclude" tag is great for sorting the template into categories, as well as making some instructions for other users of your template on how it works. This is especially important if the template is more advanced or complex. The "includeonly" tag is also usually used when making help pages, and helping the way to explain template functionality by removing complex code from sight.
 
The "noinclude" tag is great for sorting the template into categories, as well as making some instructions for other users of your template on how it works. This is especially important if the template is more advanced or complex. The "includeonly" tag is also usually used when making help pages, and helping the way to explain template functionality by removing complex code from sight.

Latest revision as of 00:12, 9 March 2010

A wiki template is not really what you would call a "template" in real world. In a wiki, we usually call that a "boilerplate".


What is a Template?[edit]

A Template is an article, just like any other, but it can be automatically pulled into other pages. This is usually for a piece of text or set of links that will appear in multiple places but could be subject to changes. It'll save you creating the text each time you need to use it and updating it on every page it's used on when it does change.

For example, using {{Template:Level_navbox}} will insert the following on to page:



If you ever want to add or change links in that navigation box you simply edit the template, then every page it is used on will display the updated navigation box. Without using a Template you would have had to change every single page, one at a time.


How do I edit a Template?[edit]

There are two ways:

  • In the case of navigation boxes the little e next to the title of the box will take you straight to edit.
  • Find the name of the template by hitting edit on the page and you'll find, as in the case above, {{Template:Level_navbox}} then you can locate that template in the Template Category and click to go to it and edit it from there.


How does it work?[edit]

In order to create a template, you start a new article, and name it like this: Template:New Template. All the content in that article will then be easily included in any other page through using the code to call it in:

{{New Template}}.


That template article content will then replace the "{{New Template}}" snippet. Check our title naming policies for further help.


Template features[edit]

Templates work like any other wiki page, and you can use any formatting that you can use elsewhere. In addition, there are two tags you can use for your template:

  • <includeonly></includeonly>
  • <noinclude></noinclude>

Everything you mark to "includeonly" will only be shown on the page where you call it from. Anything outside of this tag will not show on the including page. The "noinclude" works opposite, and anything written in that tag will be shown only on the actual template page (Template:New Template, for example).

The "noinclude" tag is great for sorting the template into categories, as well as making some instructions for other users of your template on how it works. This is especially important if the template is more advanced or complex. The "includeonly" tag is also usually used when making help pages, and helping the way to explain template functionality by removing complex code from sight.


You can ask one of the DiabloWiki sysops for more information.


All Templates[edit]

This is the list of all DiabloWiki templates.


Wiki Help Index [e]
Help Contents

Community Portal
Markup - Create article - Sandbox
Help FAQ
Wiki Support
Category Structure
Naming
DiabloWiki Policies
Help Category
Link us

Wiki Tools

Article History
Boilerplates
Deleting pages
Disambiguations
Moving Articles
Redirects
Stubs
Templates

Glossary

Articles
Categories
Images
Tables
Talk Pages
Vandalism