Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Special pages
Aurora 4x Wiki
Search
Search
Appearance
Create account
Log in
Personal tools
Not logged in
Talk
Contributions
Create account
Log in
Editing
Transclusion
Page
Discussion
English
Read
Edit
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
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!
'''[[Transclusion]]''' is generally the inclusion of the content of a document into another document by reference. In the Wikipedian context, it is the use of the [[w:Wikipedia:Template messages|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 the form: :<code><nowiki>{{template name}}</nowiki></code> Occasionally one may want to use a template, but for one reason or another may not want to use transclusion. The automatic one-time copying of a template's code/text to the location of a template tag is called [[Wikipedia:Substitution|Template substitution]] or subclusion (substitution + transclusion). To subclude a template's code/text, the template tag is modified from the standard transclusion tag to a substitution tag, simply by adding <code>subst:</code>, creating a tag with the form: <code>{{tls|Template name}}</code>. ==How transclusion works== <div style="border: 1px hidden; margin: 0.5em; padding: 0.5em; float:left; width:258px;"> [[Image:Transclusion-simple.png|left]] </div> <div class="boilerplate metadata" id="Template syntax" style="background-color: #CCFFCC; border: 1px solid #009900; margin: 0.5em; padding: 0.5em; float: right; width: 35%; "><center><b>Template syntax</b></center> If the source is in the Main article namespace (e.g., "[[Cat]]"), you must put a colon (:) in front of the name, thus: <tt><nowiki>{{:Cat}}</nowiki></tt> If the source is in the Template namespace (e.g., "[[Template:Villagepumppages]]"), just use the name itself, alone, thus: <tt><nowiki>{{Villagepumppages}}</nowiki></tt> If the source is in any other namespace (e.g., "[[User:Example]]"), you must use the full name, including the namespace, thus: <tt><nowiki>{{User:Example}}</nowiki></tt> </div> To '''transclude''' any '''source''' page (within a single MediaWiki project, such as en:Wikipedia) within another '''target''' page, include the following code: <code><nowiki>{{SOMEPAGE}}</nowiki></code> Whenever the target page '''A''' with this code is rendered, the engine will include ''in that place'' not the code itself, but the entire content of the source page '''B''', SOMEPAGE. {{clear}} <div style="{{divstylenone}} float:left; width:544px;"> [[Image:TC-mult.PNG|left]] [[Image:TC-mult-twit.PNG|left]] </div> {{clear}} For example, you might decide to place a welcome message on every newcomer's Talk Page. Transclusion creates a "live" link between the template-page and the target-page(s) upon which the message should appear. When the template is edited, all the target-pages are edited too. For example, you ''might'' decide to create a (template) page with your mailing address and include that template on not only your page, but all your friends' pages, too. When you move your [[television]] and couch to another apartment, you will ''change'' your address template, and automatically, that ''new information'' will appear on all your friends' pages. {{clear}} == Etymology == [[:en:Ted Nelson|Ted Nelson]] coined the term "[[transclusion]]," as well as "[[w:hypertext|hypertext]]" and "[[w:hypermedia|hypermedia]]", in his 1982 book, ''[[w:Literary Machines|Literary Machines]]''. ==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. For an example of how this technique can be applied to simplify the creation of [[WP:SS|summary articles]], see [[Pathology]], which consists of a collection of transcluded [[WP:LEAD|lead paragraphs]] from several main articles. ===Transclusion markup=== * '''noinclude'''. The markup <nowiki><noinclude>...</noinclude></nowiki> means that the text between the tags will not be transcluded onto another page, but will only appear on the page itself. This is useful for documentation. * '''includeonly'''. The markup <nowiki><includeonly>...</includeonly></nowiki> means that the text between the tags will only be used when the page is transcluded onto another page, and will not appear on the page itself. This can be useful, for example, for adding categories to pages transcluding a template, without adding the template itself to these categories. * '''onlyinclude'''. The markup <nowiki><onlyinclude>...</onlyinclude></nowiki> indicates that only text surrounded by "onlyinclude" markup should be transcluded onto another page. This is the most subtle of the partial transclusion tags because it often overrules the others. If there is at least one pair of "onlyinclude" tags on a page, then whenever this page is transcluded, it is ''only'' the material within the "onlyinclude" tags which gets transcluded. There can be several such sections, and within each such section, some material might be further excluded by "noinclude" tags, and might also be surrounded by "includeonly" tags so that it does not appear on the original page itself. But material outside the "onlyinclude" tags will be ignored when the page is transcluded onto another page. This can be useful, for example, to repeat a small part of one page on a second one: just surround the small part by onlyinclude tags, and transclude it onto the second page. ===Subpages=== One can cut and paste the text to be transcluded into a [[Wikipedia:Subpages|subpage]], then use the name of the subpage in the transclusion template. This approach can only be used with subpages from User, Talk or Wikipedia pages; currently, subpages [[Wikipedia:Subpages#Articles do not have sub-pages (main namespace)|cannot be created from main article pages]]. Example: you want to discuss the deletion and redirecting of [[Pussycat]] to [[Cat]]. First, create the subpage [[Talk:Pussycat/Let's delete Pussycat!]], write your comment into it, then transclude it in [[Talk:Pussycat]] and [[Talk:Cat]] using the template '''<nowiki>{{Talk:Pussycat/Let's delete Pussycat!}}</nowiki>'''. Comments posted in either talk pages will be shown in both. ===Special pages=== :''See also:[[w:Wikipedia:Special pages#Miscellaneous]]'' Some pages on [[Special:Specialpages]] can be transcluded, e.g. [[Special:Newpages]] Sample: <nowiki>{{Special:Newpages/3}}</nowiki> gives 3 new pages. ==Pages related to [[MediaWiki]] [[transclusion]]== * [[Wikipedia:MediaWiki namespace]] ** [[m:Help:MediaWiki namespace]] * [[m:Help:Variable]] *[[:w:Wikipedia talk:Template namespace#transcluding prose]] ==Templates== * [[Help:Template]] * [[w:Wikipedia:Template namespace]] * [[w:Wikipedia:Template limits]] == See also == * [[MediaZilla:4547|Request for template transclusion from Commons]] (interwiki templates, etc.) * [[w:Wikipedia:Substitution]] (the opposite of transclusion) [[Category:Edit]] [[Category:Templates]] [[fa:ویکیپدیا:تراگنجانش]] [[fr:Wikipédia:Inclusion]] [[ko:위키백과:문서 끼워넣기]] [[yi:װיקיפּעדיע:אריינשטעלן]] [[zh:Wikipedia:嵌入包含]] [[pt:Wikipedia:Predefinições]]
Summary:
Please note that all contributions to Aurora 4x Wiki 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
Aurora 4x Wiki:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Pages included on this page:
Template:Clear
(
edit
)
Template:Divstylenone
(
edit
)
Template:Tls
(
edit
)
Search
Search
Editing
Transclusion
Add topic