We have begun migration of most wikis to our new host, Amazon Web Services. All but the top 100 wikis are in read-only mode until the migration is complete. Estimated completion: TBD -- Update: Fri 10/20 11pm UTC - We have encountered some unexpected issues. Our staff is working around the clock to complete this process as quickly as possible. Thank you for your patience.

Help:Templates

From Diablo Wiki
Jump to: navigation, search
Help Topics
{{{Image}}}
{{{Header1}}} Contents
{{{Header2}}} Style Guide
{{{Header3}}} Content Guide
Editing {{{Cell4}}}
{{{Header5}}} Categories
{{{Header6}}} Images
{{{Header7}}} Redirects
{{{Header8}}} Templates
General Information {{{Cell9}}}
{{{Header10}}} To-Do List
{{{Header11}}} Administrators
{{{Header12}}} About DiabloWiki

Templates are pages that are created specifically to be included on other pages. This is useful when you want to include a table on multiple pages, instead of copying the table syntax for each page, the table is created as a template and then included on all the pages. They are most commonly created under the Template: namespace, but any page can act as a template. Navboxes, infoboxes and almost all tables used in the wiki are templates.

Why Use Templates?[edit source]

Transclusion[edit source]

Transclusion is what it's called when a page is included on another page, which is what templates are used for. It makes it possible to display the exact same information on multiple pages, and this also means that an edit on the template page immediately reflects on all the pages that the template is used on. This is very practical when the same information is displayed on multiple pages. An example of this is the navbox template which is used on over a thousand pages. If an edit is made to this template, the change will occur on all pages where it is transcluded.

{{Items}}

As seen above, using templates is quite easy. To display a template, the page name of the template is wrapped in {{ }}-brackets.

Templates can also use other templates. For instance, the Item template above uses the navbox template as a base.

Reduces Clutter[edit source]

The other reason is that it makes the content pages much easier to edit. A table usually takes up a lot of space on a page and has a lot of formatting applied to it. If one wishes to merely edit the text on a page, tables make it a lot harder to actually find what needs editing. This is mostly a convenient bonus for editors; there's no visible difference to the page if you're just browsing through the wiki as a viewer.

Using Templates[edit source]

Eastern Sun
Eastern Sun Wiki Logo.jpg
Modder tsuru, Perfect Cell, Lothar
Latest Release 3.00 R6D
Game Diablo II: Lord of Destruction
Patch Version 1.10
Platform PC, Mac
Database Database
Forum Forum at The Phrozen Keep

Using a template is very straight forward. One simply needs to link to the page using {{ and }} characters.

{{Infobox Eastern Sun}}

This tells the wiki to include the page Template:Infobox Eastern Sun onto the page. It is important to remember here that the wiki assumes that you want to fetch a page saved under the Template namespace. However, any page can be included as a template.

{{Template:Infobox Eastern Sun}}
{{Category:Eastern Sun}}

The link will link to the same page that did not use any prefix, but the second will include the actual category page.

What Is Included?[edit source]

Things that are included on a page when a template is transcluded:

  • All text and thus:
    • All images
    • All templates used on the template page itself
  • Text inside <includeonly></includeonly> tags. Anything between those two tags will only be included on the target page, but will not be displayed on the actual template page.
    • An example is Template:Monster (Diablo II). Since the table breaks unless formatted on the target page, it is useless to display it on the actual template page, since it will just clutter up the screen. Because of this, includeonly tags are used.

Things that are not included ona page when a template is transcluded:

  • Text that cannot be edited on that page. This specifically applies to categories. If a category page is used as a template, only the text actually saves on the category page will be included (which is usually just a category and some additional text).
  • Text inside <noinclude></noinclude> tags. Anything between those two tags will not be included on the target page, but will be displayed on the actual template page. This os most often used to make sure that any explanation for how a template is to be used, and any categories the template is categorized in, do not show up on the target pages.

Types of Templates[edit source]

Navboxes[edit source]

Using[edit source]

One of the most common types of templates used in the wiki are the navboxes (navigation boxes). Usually no additional formatting needs to be done for the template to actually work on the target page, and they can simply be transcluded and it's done.

Navboxes are always included at the very bottom of a page, they're the last piece of information a viewer sees on a page.

Creating[edit source]

All navboxes should be based on the Template:Navbox2. Creating a new navbox is as easy as entering all the pages that the navbox should link to and separating those links with {{*}}. Looking at how another navbox is structured should provide all the information needed to create a new one.

{{Navbox2

|Header = This is a navbox header linking to [[Diablo III]]

|Group1 = Some Articles
|Body1 = [[Diablo II]]{{*}} {{2|Maces}}{{*}} [[Tyrael]]

|Group2 = Some pages
|Body2 = [[:Category:Lore]]{{*}} [[Template:Userbox]]

}}

All navboxes should always be categorized in Category:Navbox Templates, and in some cases additional categories can be useful as well.

Infoboxes[edit source]

Infoboxes (information boxes) are used to display very specific and short information that is vital to the article in the top right corner of the article.

Using[edit source]

Like navboxes, infoboxes very rarely require any input besides their actual name. All formatting is done on the template page, and needs no additions on the target page. Typically a page will only include one infobox, and at the time of writing there are no pages in the wiki with more than one, but depending on the situation two or more could be used on the same page after one another.

Creating[edit source]

All infoboxes should be created using Template:Infobox. There can be customized some however. The infobox to the right uses one column for headers and one for actual data, but an infobox can be created without headers (like the infobox at the top of this page, Template:Infobox Help), or with some cells using headers and some not.

All infoboxes should always be categorized in Category:Infobox Templates.

This is an infobox header
Terror's End icon.png
Header Notice the two cells here
Header 2 add a non-breaking space here
Header 2.2 otherwise the header breaks
Here comes a cell without a header
Header 3 and here's a header again
{{{Cell6}}}
{{{Cell7}}}
{{{Cell8}}}
{{{Cell9}}}
{{{Cell10}}}
{{{Cell11}}}
{{{Cell12}}}
{{Infobox

|Name     = This is an infobox header
|Image    = [[Image:Terror's End icon.png]]

|Header1  = Header
|Header2  = Header 2
|Header3  = Header 2.2
|Header4  = 
|Header5  = Header 3
|Cell1    = Notice the two cells here
|Cell2    = add a [http://www.w3schools.com/HTML/html_entities.asp non-breaking space] here
|Cell3    = otherwise you get a linebreak
|Cell4    = Here comes a cell without a header
|Cell5    = and here's a header again

}}

Link Templates[edit source]

Using[edit source]

Link templates are used to shorten links and make it easier to link to pages that have some kind of classification in their name. An example would be pages pertaining to Diablo II: there pages almost always have a (Diablo II) at the end of their article names. An example would be Skeleton (Diablo II). This creates a problem when linking to the page in text: you cannot link to Skeleton (which is the general page about them) and you cannot simply link to it directly, as as lot of (Diablo II) will appear in flowing text.

Links can link to one place yet display another piece of text, but this makes the actual page very cluttered when editing if there are a lot of links there (such as in navboxes). Thus link templates are used.

All link templates are categorized in Category:Link Templates.

Complex Templates[edit source]

There are many more types of tables in the wiki used as templates, and it would take up too much space to accurately describe them all here. For help on how to use other templates, always refer to the template page. There should be an explanation of how to use them and a list of all parameters there.