Jump to content

Help:Transclusion: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
→‎Markup: clarify syntax
Replaced content with 'SE COMO ETUALA MY NAME IS MS BROWN AND I WORK AT MS61 IM A ENGLISH TEACHER ON THE FIRST FLOOR TO THE BAC'
Line 1: Line 1:
SE COMO ETUALA MY NAME IS MS BROWN AND I WORK AT MS61 IM A ENGLISH TEACHER ON THE FIRST FLOOR TO THE BAC
{{redirect3|WP:TRANS|You may be looking for [[Wikipedia:Transwiki log]], [[Help:Transwiki]], [[Wikipedia:Translation]] or [[Wikipedia:WikiProject Transwiki]]}}
{{shortcut|WP:TRANS}}
'''[[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 [[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 this form below:
:<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><nowiki>{{subst:Template name}}</nowiki></code>

{{/How Transclusion Works}}

== Etymology ==
[[Ted Nelson]] coined the term "[[transclusion]]," as well as "[[hypertext]]" and "[[hypermedia]]", in his 1982 book, ''[[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 [http://en.wikipedia.org/w/index.php?title=Pathology&oldid=301684595 this revision of Pathology], which consisted of a collection of transcluded [[WP:LEAD|lead paragraphs]] from several main articles.

{{anchor|Transclusion markup}} <!--Temp anchor
until renamed section is checked for link breakage via ''what links here''-->
===Markup===
{{also|Help:Template#Noinclude, includeonly, and onlyinclude|Help:Category#Categories_and_templates}}

There are three pairs of [[html element|tags]] that can be used in [[wikitext]] to control how transclusion affects '''''[[HTML#Elements|elements]]''''' of a template or article.
They determine whether or not wikitext renders, either in its own article, which we will call "'''here'''", or in another article where it is transcluded, which we will call "'''there'''".
*'''<nowiki><noinclude></nowiki>''' this content '''will not be rendered ''there''''' '''<nowiki></noinclude></nowiki>''' . These tags have no effect ''here''.
*'''<nowiki><includeonly></nowiki>''' this content '''will render only ''there''''', and will not render ''here'' '''<nowiki></includeonly></nowiki>''' (like [[invisible ink]] made visible by means of transclusion).
*'''<nowiki><onlyinclude></nowiki>''' this content will render ''here'' and will render ''there'' '''<nowiki></onlyinclude></nowiki>''' but '''the rest of the article will be excluded from rendering ''there'''''.
There can be several such section ''elements''. Also, they can be nested. All possible renderings are achievable. For example, to render ''there'' one or more sections of the page ''here'' use '''<nowiki><onlyinclude></nowiki>''' tags. To append text ''there'', wrap the addition in '''<nowiki><includeonly></nowiki>''' tags above, within, or below the section. To omit portions of the section, nest '''<nowiki><noinclude></nowiki>''' tags within it.

As a memory aid insert the phrase ''in transclusion'' between the two words to get "noInTransclusionInclude", "includeInTransclusionOnly" and "onlyInTransclusionInclude".

{{for example|m:template:information thread|the wikitext of the the wiki news thread.}}

===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|Wikipedia:Special pages#Miscellaneous}}

Some pages on [[Special:Specialpages]] can be transcluded, such as [[Special:Allpages]], [[Special:Prefixindex]], [[Special:Newfiles]], [[Special:Newpages]], [[Special:Recentchanges]] and [[Special:Recentchangeslinked]].

Samples:
*<nowiki>{{Special:Allpages/General}}</nowiki> – a list of pages starting at "General"
*<nowiki>{{Special:Prefixindex/General}}</nowiki> – a list of pages with prefix "General"
*<nowiki>{{Special:Newfiles/4}}</nowiki> – a gallery of the four most recently uploaded files
*<nowiki>{{Special:Newpages/5}}</nowiki> – a list of the five most recently created pages
*<nowiki>{{Special:Recentchanges/5}}</nowiki> – the five most recent changes
*<nowiki>{{Special:Recentchangeslinked/General}}</nowiki> – recent changes to the pages linked from "General"

Except for Special:Recentchangeslinked, the slash and the word/number after the slash can be omitted, giving a list of pages without a specific starting point, or a list of the default length.

==Pages related to [[MediaWiki]] [[transclusion]]==

* [[m:Help:A_simple_composite_example]]
* [[Wikipedia:MediaWiki namespace]]
** [[m:Help:MediaWiki namespace]]
* [[m:Help:Variable]]
*[[Wikipedia talk:Template namespace#transcluding prose]]

==Templates==
* [[Help:Template]]
* [[Wikipedia:Template namespace]]
* [[Wikipedia:Template limits]]

== See also ==
* [[MediaZilla:4547|Request for template transclusion from Commons]] (interwiki templates, etc.)
* [[Wikipedia:Substitution]] (the opposite of transclusion)

[[Category:Wikipedia editing]]
[[Category:Wikipedia templates]]
[[Category:Wikipedia page help]]

[[fa:ویکی‌پدیا:تراگنجانش]]
[[fr:Wikipédia:Inclusion]]
[[ko:위키백과:문서 끼워넣기]]
[[yi:װיקיפּעדיע:אריינשטעלן]]
[[zh:Wikipedia:嵌入包含]]
[[pt:Wikipedia:Predefinições]]
[[simple:Wikipedia:Transclusion]]
[[pl:Wikipedia:Transkluzja]]

Revision as of 20:41, 27 March 2010

SE COMO ETUALA MY NAME IS MS BROWN AND I WORK AT MS61 IM A ENGLISH TEACHER ON THE FIRST FLOOR TO THE BAC