Changes

ADVERTISEMENT
From Diablo Wiki
Jump to: navigation, search

Help:Template

254 bytes added, 00:12, 9 March 2010
no edit summary
== 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 casesA Template is an article, just like any other, templates 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 with variableson 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, and inside other templatesthen every page it is used on will display the updated navigation box. It might look quite complex Without using a Template you would have had to change every single page, and 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 shouldnstraight to edit. * Find the name of the template by hitting '''t edit what ''' on the page and you don't grasp yourselfll find, but they often save a lot of time as in the endcase above, as <nowiki>{{Template:Level_navbox}}</nowiki> then you can locate that work needs not template in the [[:Category:Templates|Template Category]] and click to be re-done again, go to it and can easily be edited on all pages the item is shownedit it from there.
== How does it work?==
 In order to create a template, you start a new article, and naming name it like this: [[:Template:New Template]]. All the content in that article will then be easily transcluded to 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 ==
 
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 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.
18,567
edits