Help:Templates: Difference between revisions

From StrategyWiki, the video game walkthrough and strategy guide wiki
282 bytes added ,  8 February 2008
added onlyinclude, nowiki'd tagnames --> entities for < and >
(→‎Creating a template: addition, added Documentation Subpages section)
(added onlyinclude, nowiki'd tagnames --> entities for < and >)
Line 19: Line 19:
Rules for creating a documentation subpage:
Rules for creating a documentation subpage:
*The page must be titled "Documentation" - for example: {{t|Infobox/Documentation}}.
*The page must be titled "Documentation" - for example: {{t|Infobox/Documentation}}.
*The subpage should not be categorized, however the template's categories should be listed here, surrounded by <nowiki><includeonly></nowiki> tags.
*The subpage should not be categorized, however the template's categories should be listed here, surrounded by &lt;includeonly&gt; tags.
*{{t|Documentation subpage}} should be placed at the top.
*{{t|Documentation subpage}} should be placed at the top.


Line 64: Line 64:


==Control template inclusion==
==Control template inclusion==
You can control template inclusion by the use of <code><nowiki><noinclude></nowiki></code> and
You can control template inclusion by the use of <code>&lt;noinclude&gt;</code>, <code>&lt;includeonly&gt;</code> and <code>&lt;onlyinclude&gt;</code> tags.
<code><nowiki><includeonly></nowiki></code> tags.


Anything between <code><nowiki><noinclude></nowiki></code> and <code><nowiki></noinclude></nowiki></code> will be processed and
Anything between <code>&lt;noinclude&gt;</code> and <code>&lt;/noinclude&gt;</code> will be processed and displayed only when the page is being viewed directly, not included.
displayed only when the page is being viewed directly, not included.


Possible applications are:
Possible applications are:
Line 75: Line 73:
* Explanatory text about how to use the template
* Explanatory text about how to use the template


The converse is <code><nowiki><includeonly></nowiki></code>. Text between <code><nowiki><includeonly></nowiki></code> and
The converse is <code>&lt;includeonly&gt;</code>. Text between <code>&lt;includeonly&gt;</code> and <code>&lt;/includeonly&gt;</code> will be processed and displayed only when the page is being included. The obvious application is to add all pages containing a given template to a category.
<code><nowiki></includeonly></nowiki></code> will be processed and displayed only when the page is
 
being included. The obvious application is to add all pages containing a given template to a category.
<code>&lt;onlyinclude&gt;</code> is somewhat different. Anything between
<code>&lt;onlyinclude&gt;</code> and
<code>&lt;/onlyinclude&gt;</code> displays everywhere, but everything outside of it is treated as if it was wrapped in
<code>&lt;noinclude&gt;</code> tags (so only the stuff in the onlyinclude is included on other pages).


Note that the usual update problems apply -- if you change the
Note that the usual update problems apply -- if you change the