Difference between revisions of "Help:Template"

ADVERTISEMENT
From Diablo Wiki
Jump to: navigation, search
m (Template features)
m
 
(One intermediate revision by the same user not shown)
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.
+
A wiki template is an article, just like any other, but with the ability to be embedded onto other pages.
  
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.
+
If you have made a table that you would like to include in more than one place and the data may change you can create a template for it.  An example of this would be [[Template:Blacksmith training]] which contains details of how many pages and tomes are needed to train a [[Blacksmith]].  That table is used on a [[:Special:WhatLinksHere/Template:Blacksmith_training|number of different pages]]. The [[:Template:Blacksmith_training|template]] was created and the template code <nowiki>{{Blacksmith training}}</nowiki> simply added to the place where the table needed to appear.
  
 +
If and when any details change only the one template needs to be updated.
  
== 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.
 
  
== Template features ==
+
Other examples of where [[:Category:Templates|templates]] are used in Diablo Wiki are:
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><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).
 
  
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.
+
'''<nowiki>{{Waypoint}}</nowiki>''' ...which inserts the following text:
 +
 
 +
 
 +
''{{Waypoint}}''
 +
 
 +
 
 +
As that is included on every page it saves having to type the exact same sentence out each time.
 +
 
 +
 
 +
Another, '''<nowiki>{{Skill_navbox_Diablo_III|DH}}</nowiki>''' will insert a navigation menu which looks like:
 +
 
 +
 
 +
{{Skill_navbox_Diablo_III|DH}}
 +
 
 +
 
 +
If a link ever needs changing or a new one added it only needs to be updated in that one template.
 +
 
  
  
Line 26: Line 36:
  
 
* [[Elly]]
 
* [[Elly]]
* [[MrFrye]]
+
* [[Flux]]
 +
 
  
 
== All Templates ==
 
== All Templates ==

Latest revision as of 02:06, 19 October 2013

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 source]

A wiki template is an article, just like any other, but with the ability to be embedded onto other pages.


If you have made a table that you would like to include in more than one place and the data may change you can create a template for it. An example of this would be Template:Blacksmith training which contains details of how many pages and tomes are needed to train a Blacksmith. That table is used on a number of different pages. The template was created and the template code {{Blacksmith training}} simply added to the place where the table needed to appear.

If and when any details change only the one template needs to be updated.


Other examples of where templates are used in Diablo Wiki are:


{{Waypoint}} ...which inserts the following text:


Waypoints are special plates on the ground that form a network of jump points allowing players to instantly teleport between them. The nearest waypoint for Template appears


As that is included on every page it saves having to type the exact same sentence out each time.


Another, {{Skill_navbox_Diablo_III|DH}} will insert a navigation menu which looks like:



If a link ever needs changing or a new one added it only needs to be updated in that one template.


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


All Templates[edit source]

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
DiabloWiki Policies
Help Category
Link us

Wiki Tools

Article History
Boilerplates
Deleting pages
Disambiguations
Moving Articles
Redirects
Stubs
Templates

Glossary

Articles
Categories
Images
Linking
Tables
Talk Pages
Vandalism