Difference between revisions of "Template:Include"

From Exalted - Unofficial Wiki
Jump to: navigation, search
(Defined and explained)
(No difference)

Revision as of 21:13, 22 July 2010

{{Header{{{3}}}|{{{2}}}}} {{:{{{1}}}}}

Usage

The include template allows you to embed the contents of another wiki page as a section within another page. The template creates a header followed by the contents of a specific page. At the far right of the header, it also creates a small link that sends you to the page being included.

For example, suppose you wanted to include the text of a particular artifact in more than one page, but only wanted to have one "master" copy. You could create the artifact on its own page, such as PolarCompass. Then, suppose you were building one page for "all my artifacts in alphabetical order" and another page of "all my artifacts by rating".

On the "all my artifacts in alphabetical order" page, you'd just include it, using the following:

{{Include|PolarCompass|Polar Compass|2}}

The order of the arguments matters here:

  1. Include is the name of the template.
  2. PolarCompass is the full link to the page.
  3. Polar Compass is the text you want to display as the header for the included section.
  4. 2 is the "level" you want the header. This corresponds to the number of = characters you want to give the header. So, setting this to "2" would be the same as using ==Polar Compass== as the header markup, while setting this to "4" would be like using ====Polar Compass====. This number can be between 2 and 5, inclusive.

To make this last argument make a bit more sense, take the second example: on the "all my artifacts by rating" page, you would probably have your "level 2" headers be things like ==Rating 1==, so you'd want the include artifact to show up under a "level 3" header. Thus:

{{Include|PolarCompass|The Polar Compass|3}}

Note that the "level" setting does absolutely noting to the headers in the included page. Generally speaking, it is better to only use includes on pages that contain no headers at all.

The <noinclude> and <includeonly> tags

By default, including a page includes everything on that page (including Category tags). This will often not be exactly what you want. Fortunately, MediaWiki has some special tags that allow you to control what actually gets included.

Any markup surrounded by <noinclude> tags will only appear when the page is visited directly, not when it is being included. For example, the comments section in the PolarCompass page is surrounded by such tags, so that the comments section of that page doesn't get included.

The opposite is the <includeonly>, which only shows its contents when the page is included, not when it is accessed directly. In practice, this is used much less often.