Difference between revisions of "Help:Transclusion and Substitution"
(Import from Wikipedia (essential stuff) with minor changes) |
(No difference)
|
Revision as of 16:44, 27 April 2010
Transclusion
Basics
Transclusion is the inclusion of the content of a document into another document by reference. In the Wikipedian context, it is the use of the template functionality of MediaWiki to include the same content in multiple documents without having to edit those documents separately. Template transclusion is the common way to use template messages, and is implemented by using a template tag, with this form below:
{{Template name}}
It is however possible to do this with ANY page! If the page to be transcluded is in the Main namespace (without any prefixes, like "Category","Talk","Template"), you have to add a Semilcolon (:) before the pagename:
{{:Page name}}
Partial Transclusion
By using "noinclude", "onlyinclude" and "includeonly" markup, it is possible to transclude part of a page rather than all of it. Such partial transclusions can also be achieved by transcluding from other pages such as subpages. It is often useful not to transclude some information, such as template documentation.
- Text between <noinclude> tags will not be Transcluded, but will still be visible on the original page.
- Text between <includeonly> tags will be Transcluded, but will not be visible on the original page.
- Text between <onlyinclude> tags will be Transcluded, but all text outside the tags will not be transcluded.
Substitution
Substitution is the one-time copying of any other page's content into the page currently being edited, instead of transcluding the page (usually {{:page name}}). To substitute, add subst: after the opening braces:
{{subst:page name}}
If you would edit "Page name" after the Substitution, the content on the other page will not be changed (unlike with Transclusion).
Note: Partial Substitution works the same as Partial Transclusion.