KanColle Wiki
Advertisement

Forewords

Whenever you encounter a fancy element in an article, a comment, or another user's personal page, chances are, that fancy element is the result of a template. They are the most used, most powerful and also most sophisticated tools in a wiki. They reduce the amount of copy-pasting editors have to do. They make things simple and allow new editors to produce strongly visual elements whose back-end code would burn anyone's eyeballs out.

But, even the simplified version of the back-end code can be too much at times. And many templates don't come with a user manual or they do come with one but it's incomplete and incomprehensible to the end-users. In this blog, I'll show you how to find the (missing) user manual and how to learn any template with or without a manual.


Overview

These are the steps from seeing to mastering any template.

  1. Edit the article in source editor.
  2. Locate the template and learn its name.
  3. Locate the template page in [[Template:<TemplateName>]] namespace.
  4. Learn the parameters and structure of the template.
  5. Reproduce the template and customize it to suit your need.
Note 1: Source editor is a must when it comes to working with templates. See Help:Editing#Choosing_an_editor to learn how to make the switch.


Introduction

So what are templates?

In absolute beginner and Kantai Collection fan's terms, templates are...construction, crafting, improvement screens. You input a certain amount of resources and you get ships as output. Different templates have different inputs and outputs. Akashi's arsenal screen takes screws and stock equipment in addition to resources; and naturally, the outputs aren't ships.


The structure of a template

Knowing the structure of a template makes it easy to locate any template in an article's source code.

The simplest template structure starts with a pair of curly brackets (or braces), followed by the template name, and ends with a pair of closing braces.

{{ TemplateName }}

But in reality, you will most likely encounter templates that require some inputs (aka parameters). There parameters fall between TemplateName and the closing braces. The parameters are separated by a pipe character "|".

{{ TemplateName | parameter| parameter}}

Note 2: To type the pipe character, press Shift + \ combination

There are two types of parameters: named and unnamed parameters.

  • Named parameters are longer but can be assigned in any order
  • Unnamed parameters are more concise but must be assigned in a set order

{{ TemplateName
| unnamed parameter value 1
| unnamed parameter value 2
| named parameter = value
| unnamed parameter value 3
}}

Note 3: For better readability, long templates that have lots of parameters usually feature each parameter on a separate line while short templates tend to be presented on a single line instead.

The above example also illustrates an important characteristic of unnamed parameters assignment: they ignore named parameters.

A template can also be used as a parameter of another template, this is called "nesting".

{{ TemplateName | parameter = {{AnotherTemplate}}| parameter}}

Note 4: Heavily nested templates are difficult to read when flattened in a single-line cluster. Apply the tip from Note 3 to improve the readability.
Note 5: The pipe "|" and equal sign "=" are special characters that cannot be assigned to parameters directly. Use {{!}} and {{=}} instead. Yes, they are templates too, see Template:! and Template:!


Locating a template page

Say, I would like to learn how to use that countdown timer (which turned into the big red "Maintenance has begun..." message when the timer expired) on top of Fall 2016 Event article.

The first step I'll need to do is locating the template page containing its source code. I'll need to find the exact TemplateName of the timer from the article. It isn't hard to find out the TemplateName is "Timer" because it is the first thing after double curly braces in the template's structure.

Note 6: Okay, how do I know if I got the right template? Well, I did a text search and this particular template structure contains "Maintenance has begun. Good Work Admirals." as "endText" parameter. When it doubt, it is right under the "TIME REMAINING UNTIL THE EVENT ENDS:" text and above File:Maintenancetimepeople.jpg image so I'm pretty sure this is the right one.

Now, I'll plug that TemplateName into the placeholder in the below address

http://kancolle.wikia.com/wiki/Template:<TemplateName>

and pay that address a visit.

Voila! I have located the page containing the template's source code.


Learning how to use a template

Find the document

Many templates include a documentation page at [[Template:<TemplateName>/doc]].

Note 7: If you cannot see the doc page right away from the template page, you're unlikely to find anything at /doc address either.
Note 8: In some cases, the templates can be imported from other wiki sites. The most common sources of template are https://en.wikipedia.org, http://dev.wikia.com/ and https://www.mediawiki.org/wiki/MediaWiki, searching these three sites can yield a more comprehensive user manual than the one provided at /doc.

To take it a step further, try google and see if you can find any discussions or documentations of the template.

"Template:<TemplateName> wiki"

Read the source code

While it is possible for beginners to read the source code and identify parameters from their definition, it is not an easy task as many templates are written in a mix bag of HTML, wikitext, javascript and Lua and can span across multiple files. Complex ones (Lua templates) might even have the parameters defined and processed elsewhere.

Note 9: Here's a time-saving tip for new editors. If you see a template that starts with #invoke, give up reading and try a different approach.

Parameters are defined in the template's source code between triple braces. A default value in case the parameter is not inputted can also be defined after the parameter's name, following a pipe character.

{{{ parameter's name | default value }}}

Unnamed parameters are defined with numbers as the parameter's name

{{{ 1 | default value }}}

Make sense of the template from examples

The next best bet is to learn from examples.

For this, you'll want a lot of examples so that you can get a full list of parameters (including optional ones) and acceptable inputs. You will also get a sense of how the template changes in response to different inputs. And there's a tool that helps you acquire example usages on any template; it's called "WhatLinksHere"

WhatLinksHere
For more information, see https://en.wikipedia.org/wiki/Help:What_links_here
WhatLinksHere is a wiki tool which lists the pages that link to (or redirect to, or transclude) the current page.
In the new Wikia design there is a toolbar along the bottom of the screen, which contains the headings "Share," "Follow," "My Tools" (a pop-up menu,) and "Customize." If you click "Customize," it will give you the option to put any of a number of specialised wiki functions into your "My Tools" menu, including "What links here." Once you've done that, you can use the pop-up "My Tools" menu to access "What links here" and your other tools of choice on whatever wiki page you're on at that moment.
-- Rob T Firefly 07:37, March 13, 2011 (UTC)
Alternatively, you can access the tool directly from Special:WhatLinksHere address.

Seek help

Last resort, ask the author of the template. You can find out who wrote the template from the template page's edit history. In case the author is inactive, please contact one of our staff, or the person who added the template to the article pages (use WhatLinksHere and edit history).

Note 10: If you choose to contact our staff members, please consult the list of admins from my previous blog and contact only the admins with "Developer" role and "Active" status.


See also

Advertisement