Help:Creating a Template

From FactsnViews.com
Jump to navigation Jump to search

Template:Pp-semi-indef Template:Wikipedia how to {{#invoke:For|For}} Template:Wiki markup A template is a Wikipedia page created to be included in other pages. Templates usually contain repetitive material that might need to show up on any number of articles or pages. They are commonly used for boilerplate messages, standard warnings or notices, infoboxes, navigational boxes and similar purposes.

The most common method of inclusion is called transclusion, where the wikitext of the target page contains a reference to the template, using the {{Template name}} syntax. Another method is substitution, where the content of the template is copied into the wikitext of the target page, just once, when it is saved.

Help:A quick guide to templates gives a brief introduction to the subject. There is further help from MediaWiki and Wikimedia at mw:Help:Templates, m:Help:Template and m:Help:Advanced templates.

General description

File:Introduction to templates on Wikipedia.webm
A basic overview of how templates work (8 minute video)

Most templates are pages in the Template namespace, which means that they have titles in the form "Template:XXXX". It is possible, however, to transclude and substitute from any namespace,[1] and so some template pages are placed in other namespaces, such as the User namespace. Template pages have associated talk pages.

Templates can contain any desired wikitext, including calls to other templates. They have some limited programming capacities: customizable values (called parameters), calculation and branchings (using parser functions) and access to wiki-specific variables (magic words), such as dates, times, and page names. They may also contain tags which define which parts of the wikitext are to be included when the template is transcluded or substituted. This means that the appearance of the template page itself need not be the same as that of the transcluded content (for example, it can contain documentation, categories, etc. for the template).

How to do it: To transclude a template into an article or page, type {{template name}} in the wikitext at the place where the template is to appear. The first letter may be indifferently lower- or upper-case.

The prefix Template: before the template name is the default one and need not be included. However, for templates stored in other namespaces, the prefix, such as User:, must be specified. To transclude a page in mainspace, precede its title with a colon, as {{:Page name}}.

Note: Attempting to transclude a template that does not exist produces a red link, just like linking to any other nonexistent page. Following the link allows one to create that particular template. It is not possible to transclude pages between projects (such as different language Wikipedias)—to use a template on another language project, a copy of the template must be created in that project.

Usage syntax

Parameters

Template:Further The basic transclusion syntax given above can be extended by the addition of parameters, which are used to control the template's output. The syntax for this is

  • {{template name|parameter|parameter|...}}

where template name is the name of the template, and each parameter may either contain just a value (these are called unnamed parameters) or be of the form name=value (named parameters). The first, second, third, etc. unnamed parameters will be given the names 1, 2, 3, etc.

Whitespace characters (spaces, tabs, returns) are stripped from the beginnings and ends of named parameter names and values, but not from the middle: thus {{ ... | myparam = this is a test }} has the same effect as {{ ... |myparam=this is a test}}. This does not apply to unnamed parameters, where all whitespace characters are preserved.

Which parameters (if any) can or should be passed to a template and how they are to be named depends on the coding of that template. Named parameters can be defined in any order. Superfluous or misnamed parameters will be ignored; undefined parameters will be assigned default values. If a parameter is defined more than once, the last value takes effect.

The value of a parameter can be the empty string (pipe or equals sign followed immediately by the next pipe or the closing braces). This is different from omitting the parameter altogether, which leaves it undefined, although templates are often coded so as to behave the same in both cases.

Calling

Template:Further

Calling a template is not unlike calling a variable or a function in a programming language: call it with a reference, and it returns a value (the output). Like functions, some templates accept parameters that change the output.

In MediaWiki—the wiki software that Wikipedia uses—variables have a more specific meaning that distinguishes them from templates, but they are both identified by double braces Template:Code, and they both return a value.

Whereas MediaWiki variable names are all uppercase, template names have the same basic features and limitations as all page names: they are case-sensitive (except for the first character); underscores are parsed as spaces; and they can't contain any of these characters: Template:Code (because those are reserved for wiki markup and HTML).

The number sign Template:Code is called a fragment identifier because it denotes a fragment or section of a document (such as a section in a Wikipedia article). Although it can be used to link to a section of a template page (like Template:Portal#Example), there is no reason to put a fragment identifier or fragment name in a template reference. In Template:Code, for example, the string Template:Var has no purpose, and is effectively ignored.

Substitution

When a template is substituted, its content is hard-coded in the page rather than transcluded. To learn how and when to substitute a template, see Help:Substitution to learn when and how to use substitution.

Basic template usage examples

If you wish to experiment with any of these, please use the template sandbox, your user page or sandbox

An example of a very simple template can be found at Template:Lambda, which expands out to place the lambda symbol ( λ) at that point in the text. A programmer would say that the template returns the lambda symbol ( λ).

Click on Template:Lambda the click on the "Edit source" tab to see the template code (its wikitext). The "active" part of that code, called the expansion of the template, is the single word λ. (You will recall that λ is the character entity used in HTML for the Greek letter ( λ).) The remainder of the wikitext is enclosed between {{#switch:pair

 |c|close =
 |e|empty|s|single|v|void
 |o|open
 |p|pair = <noinclude{{#if:| {{{params}}}}}
}}{{#switch:pair
 |c|close = 
 |e|empty|s|single|v|void =  />
 |o|open = >
 |p|pair = {{#ifeq:noinclude|!--||>}}...
}}{{#switch:pair
 |e|empty|s|single|v|void
 |o|open =
 |c|close
 |p|pair = {{#ifeq:noinclude|!--|-->|</noinclude>}}
}} tags so it is displayed on the template page itself but will not be displayed when the template is used (or called) on another page.

To transclude the Template:Lambda onto another page (i.e. to use it on another page), type Template:Tlc (or Template:Tlc—the case of the first letter is not significant) into the wikitext of the target page and 'show preview'. The page will be displayed with the template call were replaced by the expansion of the template. i.e. as if the wikitext actually contained &lambda; at that point. The displayed page will therefore contain the text "λ".

For example, type "The 11th letter of the Greek alphabet is the lambda ({{{{#if:lambda|lambda| tlf|...}}{{#ifeq:x|| |{{{2}}} | }}{{#ifeq:x|| |{{{3}}} | }}{{#ifeq:x|| |{{{4}}} | }}{{#ifeq:x|| |{{{5}}} | }}{{#ifeq:x|| |{{{6}}} | }}{{#ifeq:x|| |{{{7}}} | }}{{#ifeq:x|| |{{{8}}} | }}{{#ifeq:x|| |{{{9}}} | }}}})" and you will see "The 11th letter of the Greek alphabet is the lambda (Template:Lambda)". You can use templates without knowing the details of their code—you only need to remember what result they produce (this is usually described on the template page).

Another way to use this template is to substitute it. If you type "The 11th letter of the Greek alphabet is the lambda (Template:Tls)" and save the page, you will again see "The 11th letter of the Greek alphabet is the lambda (λ)". However this time, if you look again at the saved wikitext, you will see that the template calls really were replaced by the expansion of the template when you saved the page. The link between the output text and the template is now broken, and the output will not be affected by changes which might be made to the template at some future time (as it would be in the case of transclusion).

{{safesubst:#invoke:anchor|main}} Examples with parameters

An example of a template that takes parameters is the template {{about}}. Try typing {{about|how to use templates|how to use modules|Help:Module}} in the sandbox—it will produce the following text: Template:About The template {{about}} uses three unnamed parameters in the example above, but the same template can also be used with different numbers of parameters to give slightly different results, as explained in the documentation on the template page. For example, {{about||how to use modules|Help:Module}}. Note the usage of an empty parameter—in this instance, the consecutive pipes mean that the first parameter that was "passed" to the template is an empty string, which in this template will cause it to omit the initial "about" sentence. This produces:Template:About

Other templates, particularly more complex ones, take named parameters or a mixture of named and unnamed ones. A simple example is Template:Payoff matrix, used to generate a 2-by-2 grid. Type:

{{payoff matrix | UL = 5 | UR = 7 | DL = 2 | DR = 9 | Name = Example usage }}

Template:Payoff matrix to produce the grid you can see on the right.

See the template page for more possibilities. Notice that the template is used here without defining all its possible parameters—undefined parameters are given default values.

The spaces around the equal signs and before and after the parameters are used only for clarity—they are not needed and are ignored when the template is evaluated (although this is not the case with unnamed parameters). However parameter names are fully case sensitive—for example, it is not possible to replace "DR" by "dr" or "dR" in the above example. Parameters with names that are not used by the template are simply ignored.

Examining the source code of the template shows the standard table mark up with some extra triple bracket entities representing the parameters: <source lang=moin>

Left Right
Up 0, 0 0, 0
Down 0, 0 0, 0
Creating a Template

</source>

The entity {{{2L|Left}}} means use the named parameter 2L, or the text 'Left' if the parameter is not present in the call.

Usage hints and workarounds

The following points may be worth noting when using templates:

  • An unnamed parameter cannot contain an ordinary equals sign, as this would be interpreted as setting off a named parameter. (This does not apply if the equals sign comes within another template call or other item which the parser handles separately.) To pass an equals sign in an unnamed parameter (for example in a URL with key/value pairs), replace the equals sign with the special template {{{{#if: |subst:}}={{#if: ||{{{2}}}}}{{#if: ||{{{3}}}}}{{#if: ||{{{4}}}}}{{#if: ||{{{5}}}}}{{#if: ||{{{6}}}}}{{#if: ||{{{7}}}}}{{#if: ||{{{8}}}}}{{#if: ||{{{9}}}}}{{#if: ||{{{10}}}}}{{#if: ||{{{11}}}}}{{#if: ||}}}}, which returns an equals sign that will not be specially interpreted. Another method is to replace the unnamed parameter (and any subsequent unnamed parameters) with named parameters—the first unnamed parameter is equivalent to a named parameter with the name "1" and so on. So to call template {{done}} with "a=b" as the literal value for the first parameter, type either {{done|a{{=}}b}} or {{done|1=a=b}}.
  • Similarly, it is not possible to use an ordinary pipe character | in template parameters, as it will be interpreted as a separator. (Again, this does not apply if it comes within another separately parsed item, such as a piped wikilink.) This time the problem can be solved by using the magic word Template:Tnull in place of the pipe, or (if the pipe is not intended to be parsed specially at a higher level) using the HTML entity &#124;.
  • Remember that whitespace characters (spaces, tabs, carriage returns and line feeds) are not automatically stripped from the start and end of unnamed parameters (as they are from named parameters). Including such characters (or any other non-visible characters in any parameters) may in some cases affect the template's behaviour in unexpected ways. (Template designers can use {{Strip whitespace}} to remove unwanted whitespace in unnamed parameters.)
  • In documentation and discussions it is often convenient to be able to produce the template call syntax, with a link to the template in question, but without actually calling the template. This can be done easily using the "{{tl}}" template (the template link template). For example, "{{tl|Example}}" produces "{{Example}}". There is an extended version, {{tlx}}, which also supports parameters.
  • When a template is changed (when the template or one of its subtemplates is edited), the change will be reflected on all pages on which the template is transcluded. However the change may not become visible on all pages immediately—a previously cached version of a page, based on the previous version of the template, may continue to be displayed for some time. Use the purge function to force a page to be displayed using the latest versions of templates. (This includes the template page itself, if it contains usage examples.)
  • When viewing old versions of pages, remember that templates will be transcluded as they are now, not necessarily as they were when the old page version was active.
  • To list all pages onto which a template is transcluded, use What links here on the template page. (This will not include pages where the template has been substituted.)
  • To get a list of templates transcluded on a page, click "Edit", and find the list below the edit window. This list also includes the sub-templates used by the templates that are directly transcluded. To get such a list for a page section, an old version of the page, or your newly edited version prior to saving, click "Show preview" on the appropriate edit page. (For an old version, the subtemplate tree will be constructed according to the templates' current state.)
  • There are limits to the number and complexity of the templates that an article may have. See the "Expand limits" section for help in resolving this.
  • If you'd like the template to leave a time stamp or signature you can write <noinclude><nowiki></noinclude>~~~~~<noinclude></nowiki></noinclude>. But this will only work if you substitute the template. If you transclude it, you'll just get ~~~~~.
  • To improve readability, usually programmers like to split the code with newlines and indent it. Unfortunately MediaWiki software does not allow this functionality and in many instances these purpose-built newlines are treated by the software as content. One possible workaround is to add <!-- before each newline character and --> after it.

Creating and editing templates

Templates are created and edited in much the same way as any other page: choose an appropriate name, navigate to that page, then click the Edit tab or create a new page as needed. As mentioned above, templates are normally placed in the Template namespace, though templates intended for your own personal use or for experimentation can be created in your own user space. Anything that can be included on a normal page or article can be included on a template, including other templates (called subtemplates). Templates often make use of programming features—parameters, parser functions and other magic words—which allow the transcluded content to vary depending on context. There are also special tags to control which information is transcluded and which is not.

Before creating a template, do a quick search for existing templates (e.g. by exploring Category:Wikipedia templates) to see if there's already a template that does what you want, or a similar template whose code can be copied and modified (or left in place and expanded). Look for generic templates on which the new template can be based (for example, navbox templates can be easily created by calling the generic Template:Navbox).

There is no hard rule about what name to choose for a template—make it short but reasonably descriptive. If similar templates exist, try to follow a consistent naming pattern. Templates can be renamed without breaking existing transclusions, provided a redirect to the new template name is left behind.

Be extremely careful when editing existing templates—changes made can affect a large number of pages, often in ways you might not expect. For this reason many high-use templates are protected against editing except by administrators and template editors (other editors can propose changes on the talk page). Some templates offer a sandbox and test cases for experimentation.

To propose the deletion or merger of unused or inappropriate templates or templates that can easily be merged, go to Templates for discussion (TfD).

Handling parameters

The values of the parameters which can be fed to a template are represented in the template code by items enclosed between triple braces:

  • the code {{{xxx}}} will be replaced by the value of the parameter named xxx. these are known as named parameters .
  • the codes {{{1}}}, {{{2}}} etc. will be replaced by the first, second etc. unnamed parameter (or the value of a parameter named 1, 2, etc.); these are sometimes known as positional parameters

If a parameter is not assigned a value, then no replacement will take place—this means that if no value is passed for parameter xxx, the value of the expression {{{xxx}}} inside the template will literally be {{{xxx}}} not the 'blank' you may have expected. A more intuitive behaviour can be achieved by specifying default parameter values. This is done with the pipe syntax : {{{xxx|dflt}}} specifies the default value dflt for the named parameter xxx, and {{{1|dflt}}} specifies the default value dflt for the first unnamed parameter. Most often, this is used to specify null default values ({{{1|}}} or {{{xxx|}}}).

Note the default text must be real text: that you cannot assign another parameter as the default. It will simply return the 'name' of the parameter as text.

Because of the multiple uses of double-brace and triple-brace syntax, expressions can sometimes be ambiguous. It may be helpful or necessary to include spaces to resolve such ambiguity, for example by writing {{ {{{xxx}}} }} or {{{ {{xxx}} }}}, rather than typing five consecutive braces. However, watch out for unwanted whitespace appearing in template expansions.

Special caseTemplate:Colon Parameters within XML-style opening tag

Parameters do not get expanded when they are wrapped in {{#switch:pair

 |c|close =
 |e|empty|s|single|v|void
 |o|open
 |p|pair = <nowiki{{#if:| {{{params}}}}}
}}{{#switch:pair
 |c|close = 
 |e|empty|s|single|v|void =  />
 |o|open = >
 |p|pair = {{#ifeq:nowiki|!--||>}}...
}}{{#switch:pair
 |e|empty|s|single|v|void
 |o|open =
 |c|close
 |p|pair = {{#ifeq:nowiki|!--|-->|</nowiki>}}
}} tags. They however aren't expanded either if placed within the actual XML-style opening tag. Thus, the following will not work within a template:
Template:!mxt

because the parameter is not expanded. Instead, you can however use the {{#tag:}} parser function, which for example is used in {{{{#if: |subst:}}sfn{{#if: ||{{{2}}}}}{{#if: ||{{{3}}}}}{{#if: ||{{{4}}}}}{{#if: ||{{{5}}}}}{{#if: ||{{{6}}}}}{{#if: ||{{{7}}}}}{{#if: ||{{{8}}}}}{{#if: ||{{{9}}}}}{{#if: ||{{{10}}}}}{{#if: ||{{{11}}}}}{{#if: ||}}}} to generate the {{#switch:pair

 |c|close =
 |e|empty|s|single|v|void
 |o|open
 |p|pair = <ref{{#if:| {{{params}}}}}
}}{{#switch:pair
 |c|close = 
 |e|empty|s|single|v|void =  />
 |o|open = >
 |p|pair = {{#ifeq:ref|!--||>}}...
}}{{#switch:pair
 |e|empty|s|single|v|void
 |o|open =
 |c|close
 |p|pair = {{#ifeq:ref|!--|-->|</ref>}}
}} element (see also Help:Magic words#Formatting) Therefore, the following example will work:
Template:Mxt
CautionTemplate:Colon Overextending URLs

If a parameter's value is or ends with a URL, check whether it is displayed in Wikipedia with the link overextending by one or more characters after the URL so that clicking the link causes an error or failure. Ensure that, after processing by the software, a soft space (not hard or nonbreaking) follows the URL, regardless of whether you or a user supplied the URL, or it was generated by automated processing. Possibly, the source code could contain or generate a space that is discarded in the processing or there might not be any space there. Correct the source code, perhaps by forcing a soft space to appear after the URL. The {{Spaces}} template may be useful.

System variables and conditional logic

Template code often makes use of the variables and parser functions described at Help:Magic words, in order to make the template's behaviour depend on the environment (such as the current time or namespace) or on the parameter values that are passed to it. They can also be used for arithmetical calculations but certain standard programming features such as loops and variable assignment are not avalable. Full string manipulation is also not available (some templates providing such functionality have been created, but they are inefficient and imperfect).

Some of the most often used variables and functions are listed below. For more, see Help:Magic words, and the fuller documentation at the MediaWiki pages mw:Help:Magic words and mw:Help:Extension:ParserFunctions.

Examples of core parser functions
Description Text entered Result
Uppercasing text {{uc: Heavens to BETSY! }} HEAVENS TO BETSY!
Lowercasing text {{lc: Heavens to BETSY! }} heavens to betsy!
Getting a namespace name {{NS: 1 }} Talk
Getting a Wikipedia URL {{fullurl: pagename }} https://FactsnViews.com/index.php/Pagename

The ParserFunctions extension provides more programming-oriented parser functions.

Examples of extension parser functions
Description Text entered Result
Testing for equality between two strings (or parameters) {{#ifeq: yes | yes | Hooray...! | Darn...! }} yes | Hooray...! | Darn...! }}
{{#ifeq: yes | no | Hooray...! | Darn...! }} no | Hooray...! | Darn...! }}
Testing whether a string (or parameter) contains anything (other than whitespace) {{#if: {{{param|}}} | Hooray...! | Darn...! }} Hooray...! | Darn...! }}
Making a calculation (mathematics)
[area of circle of radius 4, to 3 decimal places]
{{#expr: ( pi * 4 ^ 2 ) round 3 }} {{#expr: ( pi * 4 ^ 2 ) round 3 }}
Testing the result of a calculation
[is 1230 even or odd?]
{{#ifexpr: 1.23E+3 mod 2 | Odd | Even }} Odd | Even }}
Examples of system variables
Description Text entered Result (for this help page)
Page names {{PAGENAME}} Creating a Template
{{FULLPAGENAME}} Help:Creating a Template
Name of the current namespace {{NAMESPACE}} Help
Number of registered users {{NUMBEROFUSERS}} 1
Number of pages in a given category {{PAGESINCATEGORY:"Weird Al" Yankovic albums}} 0
Current software version {{CURRENTVERSION}} 1.41.1
Timestamp of last revision {{REVISIONTIMESTAMP}} 20210423162020

The PAGENAME and NAMESPACE variables are particularly useful, and frequently used, to change template behaviour based on context. For example, if the template transcludes a category link (e.g. cleanup templates, which transclude a link categorizing the page as a page which needs cleanup), it will often check the NAMESPACE variable to make sure that talk pages, user pages or anywhere else the tag might incidentally be placed do not themselves get categorized as pages needing cleanup.

Nesting templates

Templates may contain other templates—this is usually called "nesting". As the template is processed, the wikitext produced by any nested templates is transcluded into the nesting template, so that the final product is essentially processed from the most deeply nested template out. While fairly straightforward in application, it involves some noteworthy quirks and tricks.

To pass a parameter value to a nested template, place a parameter tag as the value of one of the nested template's parameters.

  • Examples:
    • Template:A contains "the quick brown {{B|{{{3}}}}} jumps over..." This takes the value passed to the third positional parameter of Template:A and passes it as the first positional parameter of Template:B, then returns the wikitext produced by B as part of the phrase.
    • Template:A contains "the quick brown {{B|waldo={{{3}}}}} jumps over..." As previously, except the third positional parameter of Template:A is passed to the named parameter "waldo" of Template:B.

Template parameters themselves can be chosen conditionally.

  • Examples:
    • Template:A contains "the quick brown {{B|{{{3}}}=fox}} jumps over..." Template:A passes the word "fox" as a named parameter of Template:B whose name is A's third positional parameter.
    • {{#if: test string | value if test string is not empty | {{#if: test string | value if test string is not empty | value if test string is empty (or only white space) }} }}

{{#invoke:Shortcut|main}} A template can call itself but will stop after one iteration to prevent an infinite loop.

When a nested template contains unmatched braces—as in {{lb}}}—the unmatched braces are treated as text during processing, and do not affect the parsing of braces in the nesting template. If the nested template is substituted, however, the substitution is processed first, and this will change how braces are parsed in the nesting template. This has little practical use, but can occasionally introduce unexpected errors.

See the meta:Help:Advanced templates and meta:Help:Recursive conversion of wikitext for more information. These pages also contain information on unusual calls such as {{template {{{parameter|}}} }}.

Noinclude, includeonly, and onlyinclude

{{#invoke:Shortcut|main}} By default, when a template is transcluded (or substituted), the entire wikitext (code) of the template page gets included in that of the target page. However it is possible to modify that behaviour, using tags that specify which parts of the template code are to be included. This makes it possible to avoid transcluding information intended for display only on the template page itself, such as the template's documentation, categories and interwiki links. It is also possible to have parts of the code be transcluded, but not be processed on the template page itself (e.g. categories to be applied to the target pages which do not apply to the template). The tags are as follows

  • {{#switch:pair
 |c|close =
 |e|empty|s|single|v|void
 |o|open
 |p|pair = <noinclude{{#if:| {{{params}}}}}
}}{{#switch:pair
 |c|close = 
 |e|empty|s|single|v|void =  />
 |o|open = >
 |p|pair = {{#ifeq:noinclude|!--||>}}...
}}{{#switch:pair
 |e|empty|s|single|v|void
 |o|open =
 |c|close
 |p|pair = {{#ifeq:noinclude|!--|-->|</noinclude>}}
}}—the text between the noinclude tags will not be included when the template is transcluded (substituted) but will be processed on the template's page; a common use is for template documentation
  • {{#switch:pair
 |c|close =
 |e|empty|s|single|v|void
 |o|open
 |p|pair = <onlyinclude{{#if:| {{{params}}}}}
}}{{#switch:pair
 |c|close = 
 |e|empty|s|single|v|void =  />
 |o|open = >
 |p|pair = {{#ifeq:onlyinclude|!--||>}}...
}}{{#switch:pair
 |e|empty|s|single|v|void
 |o|open =
 |c|close
 |p|pair = {{#ifeq:onlyinclude|!--|-->|</onlyinclude>}}
}} – specifies that nothing on the page except what appears between the onlyinclude tags will be transcluded (substituted)
  • {{#switch:pair
 |c|close =
 |e|empty|s|single|v|void
 |o|open
 |p|pair = <includeonly{{#if:| {{{params}}}}}
}}{{#switch:pair
 |c|close = 
 |e|empty|s|single|v|void =  />
 |o|open = >
 |p|pair = {{#ifeq:includeonly|!--||>}}...
}}{{#switch:pair
 |e|empty|s|single|v|void
 |o|open =
 |c|close
 |p|pair = {{#ifeq:includeonly|!--|-->|</includeonly>}}
}}—the text between the includeonly tags will be transcluded (substituted) but will not be processed on the template's own page.
Wikitext What is rendered here (source page) What is transcluded there (destination page)
<noinclude> text1 </noinclude> text2 text1 text2 text2
<onlyinclude> text1 </onlyinclude> text2 text1 text2 text1
<includeonly> text1 </includeonly> text2 text2 text1 text2

Perhaps the most common issue with the use of these blocks is unwanted spaces or lines. It is important to remember that the effect of these tags begins immediately before the first angle bracket, not on the previous line or at the previous visible character; similarly the effect ends immediately after the last angle bracket, not on the next line or with the next visible character.

Examples
  1. Template:Green
    Template:Maroon
  2. Template:Green
    Template:Maroon
  3. Template:Green
    Template:Maroon

These tags can be nested inside each other, though (for a given page) this really only applies to the {{#switch:o

 |c|close =
 |e|empty|s|single|v|void
 |o|open
 |p|pair = <onlyinclude{{#if:| {{{params}}}}}
}}{{#switch:o
 |c|close = 
 |e|empty|s|single|v|void =  />
 |o|open = >
 |p|pair = {{#ifeq:onlyinclude|!--||>}}...
}}{{#switch:o
 |e|empty|s|single|v|void
 |o|open =
 |c|close
 |p|pair = {{#ifeq:onlyinclude|!--|-->|</onlyinclude>}}
}} tag; nesting {{#switch:o
 |c|close =
 |e|empty|s|single|v|void
 |o|open
 |p|pair = <includeonly{{#if:| {{{params}}}}}
}}{{#switch:o
 |c|close = 
 |e|empty|s|single|v|void =  />
 |o|open = >
 |p|pair = {{#ifeq:includeonly|!--||>}}...
}}{{#switch:o
 |e|empty|s|single|v|void
 |o|open =
 |c|close
 |p|pair = {{#ifeq:includeonly|!--|-->|</includeonly>}}
}} and {{#switch:o
 |c|close =
 |e|empty|s|single|v|void
 |o|open
 |p|pair = <noinclude{{#if:| {{{params}}}}}
}}{{#switch:o
 |c|close = 
 |e|empty|s|single|v|void =  />
 |o|open = >
 |p|pair = {{#ifeq:noinclude|!--||>}}...
}}{{#switch:o
 |e|empty|s|single|v|void
 |o|open =
 |c|close
 |p|pair = {{#ifeq:noinclude|!--|-->|</noinclude>}}
}} tags is fairly pointless. Be careful not to split the tags, however. Constructions like {{#switch:o
 |c|close =
 |e|empty|s|single|v|void
 |o|open
 |p|pair = <onlyinclude{{#if:| {{{params}}}}}
}}{{#switch:o
 |c|close = 
 |e|empty|s|single|v|void =  />
 |o|open = >
 |p|pair = {{#ifeq:onlyinclude|!--||>}}...
}}{{#switch:o
 |e|empty|s|single|v|void
 |o|open =
 |c|close
 |p|pair = {{#ifeq:onlyinclude|!--|-->|</onlyinclude>}}
}}abc{{#switch:o
 |c|close =
 |e|empty|s|single|v|void
 |o|open
 |p|pair = <includeonly{{#if:| {{{params}}}}}
}}{{#switch:o
 |c|close = 
 |e|empty|s|single|v|void =  />
 |o|open = >
 |p|pair = {{#ifeq:includeonly|!--||>}}...
}}{{#switch:o
 |e|empty|s|single|v|void
 |o|open =
 |c|close
 |p|pair = {{#ifeq:includeonly|!--|-->|</includeonly>}}
}}def{{#switch:c
 |c|close =
 |e|empty|s|single|v|void
 |o|open
 |p|pair = <onlyinclude{{#if:| {{{params}}}}}
}}{{#switch:c
 |c|close = 
 |e|empty|s|single|v|void =  />
 |o|open = >
 |p|pair = {{#ifeq:onlyinclude|!--||>}}...
}}{{#switch:c
 |e|empty|s|single|v|void
 |o|open =
 |c|close
 |p|pair = {{#ifeq:onlyinclude|!--|-->|</onlyinclude>}}
}}ghi{{#switch:c
 |c|close =
 |e|empty|s|single|v|void
 |o|open
 |p|pair = <includeonly{{#if:| {{{params}}}}}
}}{{#switch:c
 |c|close = 
 |e|empty|s|single|v|void =  />
 |o|open = >
 |p|pair = {{#ifeq:includeonly|!--||>}}...
}}{{#switch:c
 |e|empty|s|single|v|void
 |o|open =
 |c|close
 |p|pair = {{#ifeq:includeonly|!--|-->|</includeonly>}}
}} will not work as expected. Use the "first opened, last closed" rule that is standard for XML.

Problems and workarounds

  • If the first included character of a template or parser function is one of four wiki markup characters : ; * #[2] then it is processed as though it were at the beginning of a line (even when the template tag is not). This allows the creation of various kinds of lists in templates where the template may not always be in the correct place for a list. To avoid this, either use {{#switch:s
 |c|close =
 |e|empty|s|single|v|void
 |o|open
 |p|pair = <nowiki{{#if:| {{{params}}}}}
}}{{#switch:s
 |c|close = 
 |e|empty|s|single|v|void =  />
 |o|open = >
 |p|pair = {{#ifeq:nowiki|!--||>}}...
}}{{#switch:s
 |e|empty|s|single|v|void
 |o|open =
 |c|close
 |p|pair = {{#ifeq:nowiki|!--|-->|</nowiki>}}
}} before the markup, see Help:Nowiki, or use the HTML entities &#58; &#59; &#42; &#35; respectively. In some cases the HTML entities will work when the {{#switch:s
 |c|close =
 |e|empty|s|single|v|void
 |o|open
 |p|pair = <nowiki{{#if:| {{{params}}}}}
}}{{#switch:s
 |c|close = 
 |e|empty|s|single|v|void =  />
 |o|open = >
 |p|pair = {{#ifeq:nowiki|!--||>}}...
}}{{#switch:s
 |e|empty|s|single|v|void
 |o|open =
 |c|close
 |p|pair = {{#ifeq:nowiki|!--|-->|</nowiki>}}
}} does not.
  • For issues involving the substitution of templates (for example, how to control whether subtemplates are substituted as well when the parent template is substituted), see Help:Substitution.
  • The template {{Strip whitespace}} can be used to strip any initial or final whitespace from unnamed parameter values, if this would cause problems (named parameter values are automatically stripped in this way).
  • For debugging templates the following techniques are sometimes helpful:
    • Using "subst:"—substituting a template (rather than transcluding it) can show more clearly what is happening when the template is transcluded; see Help:Substitution.
    • Using "msgnw:"—this keyword (short for "message, nowiki") transcludes the wikitext of the template page, more or less, rather than the processed contents. It is not perfect: lists are rendered, comments are removed, and single newlines are replaced with spaces (which is particularly confounding when transcluding wikitext tables).
    • Using Special:ExpandTemplates to see the full recursive expansion of one or more templates.
  • To protect server resources and avoid infinite loops, the parser imposes certain limits on the depth of nesting of transclusions and on the page size with expanded templates. This may cause pages to break when using very complex templates, particularly if there are multiple such templates on the same page. For more information, see WP:Template limits. A page's overall load on the server can be checked by examining the generated HTML for a page and looking for the "NewPP limit report" comments.
  • Do not use = wikimarkup to create section headers within a template which is intended for use in article space—this will create an [edit] link that when transcluded will confusingly open the template for editing.
    • You may avoid [edit] links to the template by including <includeonly>__NOEDITSECTION__</includeonly>

Documentation

Template:Details Categorizing your template and documenting its proper usage will make it easier for other editors to find and use.

Documentation for users, together with the template's categories, is normally placed after the template code, inside {{#switch:pair

 |c|close =
 |e|empty|s|single|v|void
 |o|open
 |p|pair = <noinclude{{#if:| {{{params}}}}}
}}{{#switch:pair
 |c|close = 
 |e|empty|s|single|v|void =  />
 |o|open = >
 |p|pair = {{#ifeq:noinclude|!--||>}}...
}}{{#switch:pair
 |e|empty|s|single|v|void
 |o|open =
 |c|close
 |p|pair = {{#ifeq:noinclude|!--|-->|</noinclude>}}
}} tags. It is normally necessary to put the opening {{#switch:o
 |c|close =
 |e|empty|s|single|v|void
 |o|open
 |p|pair = <noinclude{{#if:| {{{params}}}}}
}}{{#switch:o
 |c|close = 
 |e|empty|s|single|v|void =  />
 |o|open = >
 |p|pair = {{#ifeq:noinclude|!--||>}}...
}}{{#switch:o
 |e|empty|s|single|v|void
 |o|open =
 |c|close
 |p|pair = {{#ifeq:noinclude|!--|-->|</noinclude>}}
}} tag immediately after the end of the code, with no intervening spaces or newlines, to avoid transcluding unwanted whitespace.

In the case of complex templates, the documentation (together with categories) is often kept on a separate subpage of the template page (named "Template:XXX/doc"). This also applies to many protected templates (to allow the information to be edited by non-administrators). This is achieved by placing the {{Documentation}} template after the main template code (within {{#switch:pair

 |c|close =
 |e|empty|s|single|v|void
 |o|open
 |p|pair = <noinclude{{#if:| {{{params}}}}}
}}{{#switch:pair
 |c|close = 
 |e|empty|s|single|v|void =  />
 |o|open = >
 |p|pair = {{#ifeq:noinclude|!--||>}}...
}}{{#switch:pair
 |e|empty|s|single|v|void
 |o|open =
 |c|close
 |p|pair = {{#ifeq:noinclude|!--|-->|</noinclude>}}
}} tags). If the "/doc" subpage does not exist, a link will then appear enabling it to be created.

Categorization

Categorize pages by template inclusion

Some templates contain category definitions in their transcluded code, i.e. they are intended to place the target pages in particular categories. This is often done with maintenance categories (placing articles into ordinary content categories in this way is discouraged). When doing this, it may be necessary to use {{#switch:pair

 |c|close =
 |e|empty|s|single|v|void
 |o|open
 |p|pair = <includeonly{{#if:| {{{params}}}}}
}}{{#switch:pair
 |c|close = 
 |e|empty|s|single|v|void =  />
 |o|open = >
 |p|pair = {{#ifeq:includeonly|!--||>}}...
}}{{#switch:pair
 |e|empty|s|single|v|void
 |o|open =
 |c|close
 |p|pair = {{#ifeq:includeonly|!--|-->|</includeonly>}}
}} tags to keep the template itself out of the category. While developing, testing, sandboxing, or demonstrating a template intended to apply a category, either temporarily replace each category with a test category (starting with X1, X2, or X3) or suppress categorization (see category suppression in templates).

Categorize templates

Categorization declaration [[Category: Some-topic templates ]] should be placed on the template's documentation page (or inside {{#switch:pair

 |c|close =
 |e|empty|s|single|v|void
 |o|open
 |p|pair = <noinclude{{#if:| {{{params}}}}}
}}{{#switch:pair
 |c|close = 
 |e|empty|s|single|v|void =  />
 |o|open = >
 |p|pair = {{#ifeq:noinclude|!--||>}}...
}}{{#switch:pair
 |e|empty|s|single|v|void
 |o|open =
 |c|close
 |p|pair = {{#ifeq:noinclude|!--|-->|</noinclude>}}
}} tags, if there is no documentation page) to avoid polluting the transcluding pages.

Aliases

Aliases can be created with redirects. For example, Template:Tsh redirects to Template:Template shortcut. Then you can write Template:Tlp instead of Template:Tlp.

It's good to prepare template aliases which only differ in whitespaces and capitalization. For example, there's a template {{See Wiktionary}}. The "W" is capital, since the word "Wiktionary" is so. But a redirect {{See wiktionary}} with lower "w" exists because users are likely to use the latter.

Template limits

{{safesubst:#invoke:anchor|main}} Template:Details "Post-expand include size" limit. When templates are rendered or expanded to HTML for viewing in your browser, they use memory. This is called the "post-expand include size" and has a limit of 2,048,000 bytes. This size is included as an invisible comment in the HTML output—use your browser's view source feature to show the raw HTML and search for newpp. The report will look like: <source lang="html4strict"> </source>

The example shows that template expansion is using 63k out of 2M of available memory.

Display problem. If too many templates are included on a page, the post-expand include size may exceed the limit. When this happens, templates after the limit will no longer expand and will instead display as a wikilink (for example, Template:templatename). Common causes are the inclusion of too many citation templates and/or flag templates. To resolve this problem substitute templates, remove templates, or split the page.


Non-rendered tranclusions still count towards limit. For example, a page which contains only {{#if:{{:Main Page}}}} would still have a post-expand include size even though it would have no output at all.

The same applies to Scribunto modules. For example, {{#invoke:Test|main}} would still increase post-expand include size even if Module:Test were simply: <syntaxhighlight lang=lua>mw.getCurrentFrame():preprocess'<!-- Hide Title of Page --> {{DISPLAYTITLE:<span style="position: absolute; clip: rect(1px 1px 1px 1px); clip: rect(1px, 1px, 1px, 1px);">{{FULLPAGENAME}}</span>}} <!-- Hide Table of Contents --> __NOTOC__ <!-- BANNER ACROSS TOP OF PAGE --> <div id="mp-topbanner" style="clear:both; position:relative; box-sizing:border-box; width:100%; margin:1.2em 0 6px; min-width:47em; border:1px solid #ddd; background-color:#f9f9f9; color:#000; white-space:nowrap;"> <!-- "WELCOME TO Facts n Views" AND ARTICLE COUNT --> <div style="margin:0.4em; width:22em; text-align:center;"> <div style="font-size:162%; padding:.1em;">Welcome to Facts-n-Views,</div> <div style="font-size:95%;padding:.1em;">an [[Policy:Core Editing Rules|encyclopedia and debate platform]] used to record, refine, discuss </div> <div style="font-size:95%;padding:.1em;">and improve the sum of all human knowledge, conclusions, and beliefs.</div> </div> <!-- PORTAL LIST ON RIGHT-HAND SIDE --> <ul style="position:absolute; right:0em; top:50%; margin-top:-2.4em; width:38%; min-width:25em; font-size:95%;"> <li style="position:absolute; left:0%; top:0em;">[[Portal:Politics|Politics]]</li> <li style="position:absolute; left:0%; top:1.6em;">[[Portal:Religion|Religion]]</li> <li style="position:absolute; left:0%; top:3.2em;">[[Portal:Philosophy|Philosophy]]</li> <li style="position:absolute; left:33%; top:0em;">[[Portal:Health|Health]]</li> <li style="position:absolute; left:33%; top:1.6em;">[[Portal:Sports|Sports]]</li> <li style="position:absolute; left:33%; top:3.2em;">[[Portal:Entertainment|Entertainment]]</li> <li style="position:absolute; left:66%; top:0;">[[Portal:In the News|In the News]]</li> <li style="position:absolute; left:66%; top:1.6em;">[[Portal:Products & Services|Products & Services]]</li> <li style="position:absolute; left:66%; top:3.2em;"><strong>[[Portal:Contents/Portals|All portals]]</strong></li> </ul> </div> <!-- MAIN PAGE BANNER {{#if:{{Main Page banner}}| <div id="mp-banner" class="MainPageBG" style="margin-top:4px; padding:0.5em; background-color:#fffaf5; border:1px solid #f2e0ce;"> {{Main Page banner}} </div> }} --> ='"`UNIQ--h-20--QINU`"'Your Help is Needed= <span style="color:black; background:yellow; font-size:16px">Help us prioritize the development of Facts-n-Views by '''filling out [https://docs.google.com/forms/d/e/1FAIpQLSePYSH2UwQOb33NO4mnEMrQEEhaR2nD-aO5dmPqpTM2uW5Ulg/viewform?usp=sf_link this survey]'''</span> ='"`UNIQ--h-21--QINU`"'Our Mission Statement= To provide world's most complete source of all human knowledge including facts, arguments, counter-arguments, opinions and experimental hypotheses using tools for collaborative editing, indexing, [[Policy:Ranking Articles|ranking quality of arguments]], and [[Policy:Mind Map Pages|mind mapping of belief systems]]. ='"`UNIQ--h-22--QINU`"'Our Current Status= This is a concept site. No company yet exists to implement the ideas herein. This site exists to propose, refine, and develop ideas for both collaborative and protected development of human knowledge and viewpoints. =='"`UNIQ--h-23--QINU`"'Expanded Statement of Objectives== '''<big>Facts-n-Views exists to provide a site to discover, document, index, summarize all human knowledge--and ''even to create new knowledge''.</big>''' Much of humanity's knowledge includes incomplete facts, claims, arguments, conclusions and beliefs that are subject to debate, discussion, grading and refinement. (See for example [[Theories regarding the causes of human consciousness]].) Therefore the guiding purpose of [[Main Page|Facts-n-Views]] is to provide new tools and [[Policy:Core Editing Rules|policies]] that help to refine, test, or at least improve the presentation of every fact, view, opinion or thesis the may be a subject of interest or debate. =='"`UNIQ--h-24--QINU`"'What makes us different, and better than, Wikipedia== It may help to see why Facts-n-Views is needed by comparing it directly to the most popular encyclopedia on the planet, [https://en.wikipedia.org/wiki/Main_Page Wikipedia]. In fact, this prototype of Facts-n-Views is built using the very same, open source software as Wikipedia. But our goals, policies and rules are very different. [[File:Counterpoint text.jpg|alt=Counterargument|thumb| *Wikipedia's core team of editors defend this practice as necessary [https://en.wikipedia.org/wiki/Wikipedia:Neutral_point_of_view#Undue_weight to protect readers from minority views being given "undue weight."]<p> <span style="color:#800000">This box is an example of how sidebar counterpoints can be inserted into any article.</span> In the future, this box would only show three lines, with an option for the reader to open it to it's full length. |220x220px]]. Wikipedia has policies in place specifically for the purpose of '''restricting controversy'''.<sup>*</sup> Contributing editors are encouraged to develop a "consensus" of what like-minded editors believe is most commonly accepted and reliable information, while allowing "due weight" to minority views. Sounds great. Wikipedia editors are constantly fighting over what is truly verifiable, reliable, neutral, much less how much "weight" should be given to any or all "minority views." The result is that it takes only a few of the most active editors, especially those who have been granted administrative status, to unilaterally ensure material that challenges their "consensus." This is called "wiki-lawyering" and is '''a process that drives away most of the people''' who try to edit Wikipedia. The problem with Wikipedia is that its policies assume that editors can actually reach a "true consensus" that can fairly report what is true while keeping false viewpoints "in their place." From this perspective, it is right and just for editors to engage in endless arguments over giving more or less space to viewpoints that either confirm or challenge each individual editor's worldview. As a result, literally every article touching even remotely on a controversial issue is especially prone to "edit wars" designed to silence facts and viewpoints that challenge the "consensus" of the small group of editors who "control" the article. Another problem with the core policies of Wikipedia is the ban on "original research." This rules blocks experts in a field from posting material based on their own expertise. FactnViews fixes this problem by creating an opportunity for experts to publish and control the presentation of their content, under their true names, while still owning the copyright to their own material, in order to obtain comments and feedback from others or simply to make their material more easily accessible to general readers. Finally, Wikipedia takes not responsibility for its content. Responsibility for both the content, and decision making regarding what is both published and not published, is shifted to a diffuse, anonymous, and unreliably polled "community" of volunteer editors. FactsnViews is different because our staff is accountable to both the contributors and readers to ensure that everyone has a fair opportunity to present their material either as individuals or in a collaborative fashion. There will be public accountability for the policies and decisions made regarding published content. =='"`UNIQ--h-25--QINU`"'A better platform for creating and debating content== [[File:Comment.jpg|alt=Alternative text just comes up when a reader highlights the Counterpoint image|thumb|To insert a comment or counterpoint, go into Edit mode, Select Insert, select Image "Counterpoint text.jpg" or Comment.jpg and then enter your comment in the Caption area. You can also insert links, such as this one: [[Global warming is mostly due to human activity.]] ]] By contrast, at Facts-n-Views '''''we believe that controversies should be explored, not suppressed.''''' For many, perhaps most topics, ''different viewpoints are a most critical part of the human knowledge.'' Therefore, we are committed to providing a platform for all viewpoints to present the different facts, rationales and belief systems. We also want to make it easier for each faction to collaborate in presenting their position in as convincing of a fashion as each faction can muster, while also exposing their position to criticism, debate, and a public ranking of the quality of their arguments. See for example, the link for [[Global_warming]]. The only caveat is that we want to also provide a way for competing viewpoints to [[Policy:Core_Editing_Rules#CER-2._If_your_material_does_not_strengthen_the_thesis_presented_by_originators_of_the_page.2C_then_it_must_be_inserted_elsewhere.2C_such_as_in_a_sidebar_comment.| interact in a healthy, constructive way,]] allowing readers to find, discover, explore, and even [[Policy:Ranking Articles|vote on the viewpoints]] with which they most agree or disagree. We believe that by providing a [[Policy:Core_Editing_Rules|''healthy, structured way to not only record but to debate and then refine these different viewpoints'']], we can help to directly advance human knowledge. These goals are achieved by having different types of pages which are governed by different rules for editing and commenting on material. There are several types of pages: '''Encylopedic Pages''' :*[[Policy:Wikipiedia with Comments|Wikipedia with Comments]]: These are copies of Wikipedia pages with user comments, including links, attached. :*[[Policy:Encyclopedic pages|Encyclopedic pages]]: Whenever our users believe the Wikipedia page is inadequate, they can create a new page with the same title that offers a basic outline of the topic with a list of related articles defending, or criticizing, various views on the topic. (See, for example, [[Global warming]].) These public domain pages are shared and collaboratively developed by our users and will be linked to the Wikipedia article and vice versa. '''Original Research and Opinion Pages''' :*[[Policy:Collaborative thesis|Collaborative thesis]]: These pages offer a defense of a specific propositional statement jointly developed by like-minded authors. The page will also show short comments and links to counterarguments on by others. The content will belong to the public domain. :*[[Policy:Personal thesis|Personal thesis]]: For an extra charge, these pages offer original research or a defense of a specific propositional statement jointly developed by one person or a small group invited by the creator of the page to collaborate on the article. While the primary content cannot be changed by others, anyone can create limited comments including links to other articles. Also, the copyright to the content is retained by the author(s) and cannot be reproduced elsewhere without their consent. '''Organizational and Ratings Pages''' :*[[Policy:Lists and Categories|Lists and Categories]]: collaborative or individual lists of links to articles or other lists to organize the discovery of content. :*[[Policy:Mind Map Pages|Mind Map Pages]]: mind maps created by individuals showing the linkage between propositions defining a set of beliefs :*[[Policy:Ranking Articles|Ranking Articles]]: a ranking system will allow readers and editors to rank articles on multiple factors. The data from these ratings will be used to create generated page ranking and rank sorted index pages, including, for example, statistics on the propositions receiving the highest, and lowest levels, of support from readers '''Administrative Pages''' :*[[Policy:Administrative|Administrative]]: Policy and help pages :*[[Policy:Dispute Resolution|Dispute Resolution]]: Resources to investigate and initiate a dispute over content or policy. :*[[Policy:Development Notes|Development Notes]]: These are ideas for developing and improving the site, including pricing structures. Learn about each of these before you begin to edit. In addition, we provide and enforce [[Policy:Core_Editing_Rules|'''editing rules''']] to safeguard each users contributions while also providing an appropriate space for contributors who want to offer alternative views and facts. ='"`UNIQ--h-26--QINU`"'Your Help is Needed= <span style="color:maroon; background:white; font-size:16px">Help us prioritize the development of Facts-n-Views by filling out [https://docs.google.com/forms/d/e/1FAIpQLSePYSH2UwQOb33NO4mnEMrQEEhaR2nD-aO5dmPqpTM2uW5Ulg/viewform?usp=sf_link this survey.]</span> <!-- Today's Featured Content --> {| role="presentation" id="mp-upper" style="width: 100%; margin-top:4px; border-spacing: 0px;" <!-- Column 1: TODAY'S Hot Debate; DID YOU KNOW --> | id="mp-left" class="MainPageBG" style="width:45%; border:1px solid #cef2e0; padding:0; background:#f5fffa; vertical-align:top; color:#000;" | <h2 id="mp-tfa-h2" style="margin:0.5em; background:#cef2e0; font-family:inherit; font-size:120%; font-weight:bold; border:1px solid #a3bfb1; color:#000; padding:0.2em 0.4em;">Today's featured article</h2> <div id="mp-dyk" style="padding:0.1em 0.6em 0.5em;>[[Global warming]]</div> <h2 id="mp-dyk-h2" style="clear:both; margin:0.5em; background:#cef2e0; font-family:inherit; font-size:120%; font-weight:bold; border:1px solid #a3bfb1; color:#000; padding:0.2em 0.4em;">Did you know...</h2> <div id="mp-dyk" style="padding:0.1em 0.6em 0.5em;>[[Creating a Sidebar|How to create a sidebar comment]]</div> | style="border:1px solid transparent;" | <!-- Column 2: Featured List --> | id="mp-right" class="MainPageBG" style="width:55%; border:1px solid #cedff2; padding:0; background:#f5faff; vertical-align:top;"| <h2 id="mp-itn-h2" style="margin:0.5em; background:#cedff2; font-family:inherit; font-size:120%; font-weight:bold; border:1px solid #a3b0bf; color:#000; padding:0.2em 0.4em;">Featured List</h2> <div id="mp-itn" style="padding:0.1em 0.6em;">[[Theories regarding the causes of human consciousness]]</div> <h2 id="mp-otd-h2" style="clear:both; margin:0.5em; background:#cedff2; font-family:inherit; font-size:120%; font-weight:bold; border:1px solid #a3b0bf; color:#000; padding:0.2em 0.4em;">You should know . . . </h2> <div id="mp-otd" style="padding:0.1em 0.6em 0.5em;">[[Policy:Core Editing Rules|The rules for adding content]]</div> |} =='"`UNIQ--h-27--QINU`"' Recent Pages == [[Global warming]] [[Theories regarding the causes of human consciousness]] [[Creating a Sidebar]] [[Policy:Lists and Categories]] [[Policy:Core Editing Rules]] [[Policy:Facts-n-Views Editorial Intervention|Appeals for Editorial Intervention]] =='"`UNIQ--h-28--QINU`"' Tips for Getting started == * [https://www.mediawiki.org/wiki/Special:MyLanguage/Manual:Configuration_settings Configuration settings list] * [https://www.mediawiki.org/wiki/Special:MyLanguage/Manual:FAQ MediaWiki FAQ] * [https://lists.wikimedia.org/mailman/listinfo/mediawiki-announce MediaWiki release mailing list] * [https://www.mediawiki.org/wiki/Special:MyLanguage/Localisation#Translation_resources Localise MediaWiki for your language] * [https://www.mediawiki.org/wiki/Special:MyLanguage/Manual:Combating_spam Learn how to combat spam on your wiki] Consult the [https://www.mediawiki.org/wiki/Special:MyLanguage/Help:Contents User's Guide] for information on using the wiki software. <strong>MediaWiki has been installed.</strong> Consult the [https://www.mediawiki.org/wiki/Special:MyLanguage/Help:Contents User's Guide] for information on using the wiki software. =='"`UNIQ--h-29--QINU`"' Getting started == * [https://www.mediawiki.org/wiki/Special:MyLanguage/Manual:Configuration_settings Configuration settings list] * [https://www.mediawiki.org/wiki/Special:MyLanguage/Manual:FAQ MediaWiki FAQ] * [https://lists.wikimedia.org/mailman/listinfo/mediawiki-announce MediaWiki release mailing list] * [https://www.mediawiki.org/wiki/Special:MyLanguage/Localisation#Translation_resources Localise MediaWiki for your language] * [https://www.mediawiki.org/wiki/Special:MyLanguage/Manual:Combating_spam Learn how to combat spam on your wiki]'-- remove this line and post-expand include size becomes zero return {main = function()end}-- p.main() has no return value</syntaxhighlight>

Lua programming language

Template:Main article Since February 2013 Lua programming language is available for use via the Scribunto MediaWiki extension. Lua code can be embedded into wiki templates by employing the "{{#invoke:}}" functionality of the Scribunto MediaWiki extension. The Lua source code is stored in pages called modules, and these individual modules are then invoked on template pages. For example, Module:Bananas can be invoked using the code {{#invoke:Bananas|hello}} to print the text "Hello, world!".

Template search

Template:Main As an alternative to using this index linked above, you can search the Template namespace using the Special:Search box below:

<inputbox> type=fulltext width=25 namespaces=Template** searchbuttonlabel=Search Template namespace break=no placeholder=i.e. Citation </inputbox>

See also

Help pages Manual pages Special pages Other pages not for direct viewing

Notes

Template:Reflist

Template:Wikipedia template messages Template:Wikipedia technical help

  1. Namespaces from which transclusion is not allowed are specified on a wiki by the variable $wgNonincludableNamespaces
  2. These are defined in the doBlockLevels function of Parser.phpTemplate:Dead link