Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Numinix MediaWiki Demo
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Help/Templates
(section)
Page
Discussion
English
Read
Edit
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Special pages
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== Controlling template inclusion == <!--T:65--> </translate> <translate><!--T:66--> By default, a template's content is displayed in its entirety, both when viewed directly and when included in another page.</translate> <translate><!--T:320--> The template's page when viewed directly appears exactly as the template would render without any parameters.</translate> <translate><!--T:321--> If the template requires parameters to function properly, this will result in raw wikitext syntax or errors as a result of them being missing.</translate> <translate><!--T:326--> For example:</translate> * <translate><!--T:327--> If a parameter has no default value, it shows as the literal text <tvar name="1"><nowiki>}</nowiki></tvar>, indicating the template needs a parameter.</translate> * <translate><!--T:328--> If a parameter has an empty default value (it is written as <tvar name="1"><nowiki>}</nowiki></tvar>), it displays nothing, which achieves the intended effect but lacks clarity for self-documentation.</translate> }</nowiki></code></tvar> could clarify a parameter's role, especially for templates involving images.</translate> |1=<translate><!--T:330--> image</translate> }} * <translate><!--T:331--> If a parameter without a default is passed to the <tvar name="1"><code>#expr</code></tvar> parser function, it results in an error message: "Expression error: unrecognized punctuation character '{'."</translate> * <translate><!--T:332--> If a template creates a table, it's helpful for the template page to show the table's structure rather than the wikitext used to make it.</translate> <translate><!--T:333--> To do this, the table syntax isn't enclosed in tags, and each table element includes both <tvar name="1"></tvar> and <tvar name="2"></tvar> parts where needed.</translate> <translate> <!--T:322--> However, you can control which parts of a template will be seen and included by the use of the <tvar name=noinclude></tvar>, <tvar name=includeonly></tvar> and <tvar name=onlyinclude></tvar> tags. <!--T:67--> Anything between <tvar name=noinclude_start></tvar> and <tvar name=noinclude_end></tvar> will be seen only when the template's page is being viewed directly, but not when it is included in another page. This is useful when you want to include text or code in a template that you do not want to propagate to any pages which include it, such as: <!--T:68--> * [[<tvar name=1>Special:MyLanguage/Help:Categories</tvar>|Category]] links when categorizing the template itself</translate> <translate> <!--T:69--> * [[<tvar name=1>Special:MyLanguage/Help:Links#Interlanguage links</tvar>|interlanguage links]] to similar templates in other languages</translate> <translate> <!--T:70--> * Explanatory text about how to use the template.</translate> <translate><!--T:334--> It's a common pattern on some wikis to use a template like <tvar name="1"></tvar> to transclude the documentation from a subpage of the template.</translate> <translate><!--T:335--> For example, <tvar name="1">[[Template:Void]]</tvar> is documented at <tvar name="2">[[Template:Void/doc]]</tvar>.</translate> <translate> <!--T:71--> Likewise, anything between <tvar name=includeonly_start></tvar> and <tvar name=includeonly_end></tvar> will be processed and displayed only when the page is being included, but not when the template page is being viewed directly, and is useful in situations such as: <!--T:72--> * [[<tvar name=1>Special:MyLanguage/Help:Categories</tvar>|Categorizing]] pages which include the template.</translate> <translate><!--T:470--> '''Note:''' when changing the categories applied by a template in this fashion, the categorization of the pages which include that template may not be updated until some time later: this is handled by the .</translate> <translate><!--T:471--> To force the re-categorization of a particular page, open that page for editing and save it without changes.</translate> <translate> <!--T:73--> * Ensuring that the template's code is not executed when viewing the template page itself. Typically this is because it expects parameters, and its execution without parameters has an undesired result. </translate> <translate><!--T:74--> Everything outside <tvar name=noinclude></tvar> and <tvar name=includeonly></tvar> is processed and displayed normally; that is, both when the template page is being viewed directly and when the template is included in another page.</translate> <translate><!--T:127--> The focus is on what is inside these two tags.</translate> <translate><!--T:128--> Everything outside <tvar name=onlyinclude></tvar> tags is discarded in the transclusion.</translate> <translate><!--T:129--> Even sections tagged includeonly are discarded in the transclusion unless they are also tagged as onlyinclude.</translate> <translate><!--T:130--> The focus is only on what is inside this tag.</translate> <translate><!--T:383--> For example, if a page like [[<tvar name=1>Special:MyLanguage/Help:Templates/onlyinclude demo</tvar>|Help:Templates/onlyinclude demo]] has the wikitext:</translate> <syntaxhighlight lang="wikitext"> abc<onlyinclude>def</onlyinclude>ghi<includeonly>jkl</includeonly> </syntaxhighlight> <translate> <!--T:384--> The result of transcluding it is <tvar name=1></tvar>. <!--T:150--> Nesting of these tags is also possible. </translate> <translate><!--T:131--> The three partial transclusion tags enable all possible combinations of what is processed and rendered.</translate> <translate><!--T:132--> Comments also fill a role.</translate> <translate><!--T:323--> Inclusion tags are respected when using <tvar name="1"><code><nowiki></nowiki></code></tvar>, but they are '''not''' respected when using <tvar name="2"><code><nowiki></nowiki></code></tvar> as that displays the raw wikitext without any processing.</translate> <translate>
Summary:
Please note that all contributions to Numinix MediaWiki Demo may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Project:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)