Help:Advanced Templates

Parameters
On Wikis, parameters are variables in which information is "stored" and can be used by templates to display according to it's value. This section will give an idea on how to use them. Template:Infobox Item is one of our most used templates on this Wiki, its usage includes a large number of parameters, but effectively displays the Item pages with consistency and much less work. Here is a sample of an item's source:

Setting Parameters
Notice the 'name', 'flavortext, 'itemclass' and so on? They're all parameters, the stuff that matters is the text after the equals sign (=). Note: there are more parameters, see the template's documentation for a list)

Using Parameters
Parameter test #1: Test #1: If a page contains this, when transcluded it will display whatever the test's parameter value is, for example, if you were to transclude this page and inserted the parameter: It would display 1 instead of  However, if  weren't defined, it would display as that, as there is no parameter default. Which we will move on to...

Parameter Default
Parameter defaults are set when there is no parameter in a template call, they're defined in the templates source. Using the above example, if we were to change the parameter usage to this: The parameter default would be default. This can be a word, sentence or even blank. In the above example, default would be displayed if the template call had no "test" parameter, e.g:

Parser functions
Parser functions can be used to display things according to what a parameters value is, it's a little more advanced than merely displaying the information. For example: In pseudocode this is: "If there is a parameter test then display {test value}, else if there is no parameter test display no"

More Advanced...
{{#if:{{{test|}}}|{{#iferror:{{#expr:{{{test}}}*10}}|a|b}} Pseudocode: "If parameter test exists, then if there's an error output when the expression "{test}*10" is applied, then display a, else if there is no error output, display b"

That's pretty advanced, you might not understand it entirely yet, but it isn't required for most edits on the Wiki.