Help:Transclusion

From WiRNS Wiki
Revision as of 19:59, 14 April 2011 by SpikeToronto (Talk)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Transclusion is generally the inclusion of the content of a document into another document by reference. In a Wikipedia 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 the form:

{{template name}}

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 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 subst:, creating a tag with the form: {{subst:template name}}.

Contents

How transclusion works

To transclude any source page (within a single MediaWiki project, such as en:Wikipedia) within another target page, include the following code:

{{SOMEPAGE}}

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.

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.

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 summary articles, see [1], which consisted of a collection of transcluded lead paragraphs from several main articles.

Transclusion markup

Subpages

One can cut and paste the text to be transcluded into a 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 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 {{Talk:Pussycat/Let's delete Pussycat!}}. Comments posted in either talk page 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: {{Special:Newpages/3}} gives 3 new pages.

Alternatives to transclusion by template

Labeled Section Transclusion

An extension called Labeled Section Transclusion enables marked sections of text to be transcluded. An extension with a somewhat similar function is PageVariableExtension.

Semantic MediaWiki

The Semantic MediaWiki extension uses inline queries to query and display semantic data. There are currently two ways to perform transclusion or something similar:

  1. Transclusion proper. The display format "embedded" ensures that selected pages (mainspace articles, templates, etc.) are transcluded. As with templates, sections placed between noinclude tags will be omitted.
  2. Selected passages in a page can be assigned a property of type 'Text' so that they are stored as plain text (note that they cannot contain internal or external links). These selections can be requested by running an inline query for this type of property.

See http://semantic-mediawiki.org/wiki/Help:Inline_queries for further information.

Pages related to MediaWiki transclusion

Templates

See also

fr:Wikipédia:Inclusion ko:위키백과:문서 끼워넣기 yi:װיקיפּעדיע:אריינשטעלן zh:Wikipedia:嵌入包含 pt:Wikipedia:Predefinições

{{#if:{{#switch:Transclusion |=Languages: |Languages=Languages: |MediaWiki=Languages: |af=Taal: |aln=Gjuha: |am=ቋምቋ፦ |an=Idioma: |ang=Sprǣc: |ar=:اللغة |arc=ܠܫܢܐ: |arn=Dungun: |arz=:اللغة |as=ভাষা: |ast=Llingua: |avk=Ava: |ay=Aru: |az=Dil: |bat-smg=Kalba: |bcc=:زبان |bcl=Tataramon: |be=Мова: |be-tarask=Мова: |bg=Език: |bn=ভাষা: |br=Yezh : |bs=Jezik: |ca=Llengua: |cdo=Ngṳ̄-ngiòng: |ce=Мотт: |ceb=Pinulongan: |ch=Lengguahe: |ckb-arab=:زمان |co=Lingua: |crh-cyrl=Тиль: |crh-latn=Til: |cs=Jazyk: |cu=ѩꙁꙑ́къ : |cv=Чĕлхе: |cy=Iaith: |da=Sprog: |de=Sprache: |diq=Zıwan: |dsb=Rěc: |ee=Gbe: |el=Γλώσσα: |en=Language: |eo=Lingvo: |es=Idioma: |et=Keel: |eu=Hizkuntza: |ext=Palra: |fa=:زبان |fi=Kieli: |fo=Mál: |fr=Langue: |frc=Langue: |frp=Lengoua: |fur=Lenghe: |fy=Taal: |ga=Teanga: |gag=Dil: |gan-hans=语言: |gan-hant=語言: |gl=Lingua: |gn=Ñe'ẽ: |got=Razda: |grc=Γλῶσσα: |gsw=Sproch: |gu=ભાષા: |gv=Çhengey: |hak=Ngî-ngièn: |haw=Kou 'ōlelo: |he=שפה: |hi=भाषा: |hif-latn=Bhasa: |hr=Jezik: |hsb=Rěč: |ht=Lang: |hu=Nyelv: |hy=Լեզու. |ia=Lingua: |id=Bahasa: |ie=Lingue: |ilo=Lengguahe: |io=Linguo: |is=Tungumál: |it=Lingua: |ja=言語: |jv=Basa: |ka=ენა: |kaa=Til: |kab=Tutlayt: |kg=Ndinga: |kiu=Zon: |kk-arab=:ٴتىل |kk-cyrl=Тіл: |kk-latn=Til: |km=ភាសា៖ |kn=ಭಾಷೆ: |ko=언어: |ksh=Sproch: |ku-latn=Ziman: |kv=Кыв: |kw=Yeth: |ky=Тил: |la=Lingua: |lb=Sprooch: |lfn=Lingua: |li=Taol: |lij=Lengoa: |loz=Zwa Siselect: |lt=Kalba: |lv=Valoda: |lzh=語: |mdf=Кяль: |mg=fiteny: |mhr=Йылме: |mk=Јазик: |ml=ഭാഷ: |mn=Хэл: |mr=भाषा: |ms=Bahasa: |mt=Lingwa: |mwl=Lhéngua: |my=ဘာသာ: |myv=Кель: |nah=Tlahtōlli: |nap=Lengua: |nds=Spraak: |nds-nl=Taal: |ne=भाषा: |new=भाषा: |nl=Taal: |nn=Språk: |no=Språk: |nso=Polelo: |oc=Lenga: |os=Æвзаг: |pa=ਭਾਸ਼ਾ: |pam=Amanu: |pdc=Schprooch: |pdt=Sproak: |pl=Język: |pms=Lenga: |pnb=بولی: |pnt=Γλώσσαν: |prg=Bilā: |ps=ژبه: |pt|pt-br=Língua: |qu=Rimay: |rm=Lingua: |ro=Limba: |roa-tara=Lénga: |ru=Язык: |sa=भाषा: |sah=Омугун тыла: |sc=Limba: |scn=Lingua: |sco=Leid: |sdc=Linga: |se=Giella: |sei=Itom: |sh=Jezik: |shi=tutlayt: |si=භාෂාව: |sk=Jazyk: |sl=Jezik: |sli=Sproache: |so=Luqada: |sq=Gjuha: |sr-ec=Језик: |sr-el=Jezik: |srn=Tongo: |ss=Lúlwîmi: |stq=Sproake: |su=Basa: |sv=Språk: |sw=Lugha: |szl=Godka: |ta=மொழி: |te=భాష: |tet=Lian: |tg-cyrl=Забон: |th=ภาษา: |ti=ቋንቋ: |tk=Dil: |tl=Wika: |to=Lea: |tr=Dil: |tt-cyrl=Тел: |tyv=Дыл: |ug-arab=:تىل |ug-latn=Til: |uk=Мова: |vec=Lengua: |vep=Kel’: |vi=Ngôn ngữ: |vo=Pük: |vro=Kiil: |wa=Lingaedje: |war=Yinaknan: |wo=Làkk: |wuu=语言: |xal=Келн: |xh=Ulwimi: |xmf=ნინა: |yi=שפראך: |yo=Èdè: |yue=語言: |zea=Taele: |zh-hans=语言: |zh-hant=語言: |zu=Ulimi: |#default=Language: }} | |

}}

{{#switch:Transclusion |=Languages: |Languages=Languages: |MediaWiki=Languages: |af=Taal: |aln=Gjuha: |am=ቋምቋ፦ |an=Idioma: |ang=Sprǣc: |ar=:اللغة |arc=ܠܫܢܐ: |arn=Dungun: |arz=:اللغة |as=ভাষা: |ast=Llingua: |avk=Ava: |ay=Aru: |az=Dil: |bat-smg=Kalba: |bcc=:زبان |bcl=Tataramon: |be=Мова: |be-tarask=Мова: |bg=Език: |bn=ভাষা: |br=Yezh : |bs=Jezik: |ca=Llengua: |cdo=Ngṳ̄-ngiòng: |ce=Мотт: |ceb=Pinulongan: |ch=Lengguahe: |ckb-arab=:زمان |co=Lingua: |crh-cyrl=Тиль: |crh-latn=Til: |cs=Jazyk: |cu=ѩꙁꙑ́къ : |cv=Чĕлхе: |cy=Iaith: |da=Sprog: |de=Sprache: |diq=Zıwan: |dsb=Rěc: |ee=Gbe: |el=Γλώσσα: |en=Language: |eo=Lingvo: |es=Idioma: |et=Keel: |eu=Hizkuntza: |ext=Palra: |fa=:زبان |fi=Kieli: |fo=Mál: |fr=Langue: |frc=Langue: |frp=Lengoua: |fur=Lenghe: |fy=Taal: |ga=Teanga: |gag=Dil: |gan-hans=语言: |gan-hant=語言: |gl=Lingua: |gn=Ñe'ẽ: |got=Razda: |grc=Γλῶσσα: |gsw=Sproch: |gu=ભાષા: |gv=Çhengey: |hak=Ngî-ngièn: |haw=Kou 'ōlelo: |he=שפה: |hi=भाषा: |hif-latn=Bhasa: |hr=Jezik: |hsb=Rěč: |ht=Lang: |hu=Nyelv: |hy=Լեզու. |ia=Lingua: |id=Bahasa: |ie=Lingue: |ilo=Lengguahe: |io=Linguo: |is=Tungumál: |it=Lingua: |ja=言語: |jv=Basa: |ka=ენა: |kaa=Til: |kab=Tutlayt: |kg=Ndinga: |kiu=Zon: |kk-arab=:ٴتىل |kk-cyrl=Тіл: |kk-latn=Til: |km=ភាសា៖ |kn=ಭಾಷೆ: |ko=언어: |ksh=Sproch: |ku-latn=Ziman: |kv=Кыв: |kw=Yeth: |ky=Тил: |la=Lingua: |lb=Sprooch: |lfn=Lingua: |li=Taol: |lij=Lengoa: |loz=Zwa Siselect: |lt=Kalba: |lv=Valoda: |lzh=語: |mdf=Кяль: |mg=fiteny: |mhr=Йылме: |mk=Јазик: |ml=ഭാഷ: |mn=Хэл: |mr=भाषा: |ms=Bahasa: |mt=Lingwa: |mwl=Lhéngua: |my=ဘာသာ: |myv=Кель: |nah=Tlahtōlli: |nap=Lengua: |nds=Spraak: |nds-nl=Taal: |ne=भाषा: |new=भाषा: |nl=Taal: |nn=Språk: |no=Språk: |nso=Polelo: |oc=Lenga: |os=Æвзаг: |pa=ਭਾਸ਼ਾ: |pam=Amanu: |pdc=Schprooch: |pdt=Sproak: |pl=Język: |pms=Lenga: |pnb=بولی: |pnt=Γλώσσαν: |prg=Bilā: |ps=ژبه: |pt|pt-br=Língua: |qu=Rimay: |rm=Lingua: |ro=Limba: |roa-tara=Lénga: |ru=Язык: |sa=भाषा: |sah=Омугун тыла: |sc=Limba: |scn=Lingua: |sco=Leid: |sdc=Linga: |se=Giella: |sei=Itom: |sh=Jezik: |shi=tutlayt: |si=භාෂාව: |sk=Jazyk: |sl=Jezik: |sli=Sproache: |so=Luqada: |sq=Gjuha: |sr-ec=Језик: |sr-el=Jezik: |srn=Tongo: |ss=Lúlwîmi: |stq=Sproake: |su=Basa: |sv=Språk: |sw=Lugha: |szl=Godka: |ta=மொழி: |te=భాష: |tet=Lian: |tg-cyrl=Забон: |th=ภาษา: |ti=ቋንቋ: |tk=Dil: |tl=Wika: |to=Lea: |tr=Dil: |tt-cyrl=Тел: |tyv=Дыл: |ug-arab=:تىل |ug-latn=Til: |uk=Мова: |vec=Lengua: |vep=Kel’: |vi=Ngôn ngữ: |vo=Pük: |vro=Kiil: |wa=Lingaedje: |war=Yinaknan: |wo=Làkk: |wuu=语言: |xal=Келн: |xh=Ulwimi: |xmf=ნინა: |yi=שפראך: |yo=Èdè: |yue=語言: |zea=Taele: |zh-hans=语言: |zh-hant=語言: |zu=Ulimi: |#default=Language: }} English {{#ifexist: {{#if: | | {{#if: Help | Help:}}Transclusion}}/af |  • {{#if: |Afrikaans| Afrikaans}}|}}{{#ifexist: {{#if: | | {{#if: Help | Help:}}Transclusion}}/ar |  • {{#if: |العربية| العربية}}|}}{{#ifexist: {{#if: | | {{#if: Help | Help:}}Transclusion}}/ast |  • {{#if: |Asturianu| Asturianu}}|}}{{#ifexist: {{#if: | | {{#if: Help | Help:}}Transclusion}}/az |  • {{#if: |Azərbaycanca| Azərbaycanca}}|}}{{#ifexist: {{#if: | | {{#if: Help | Help:}}Transclusion}}/bcc |  • {{#if: |بلوچی مکرانی| بلوچی مکرانی}}|}}{{#ifexist: {{#if: | | {{#if: Help | Help:}}Transclusion}}/bg |  • {{#if: |Български| Български}}|}}{{#ifexist: {{#if: | | {{#if: Help | Help:}}Transclusion}}/br |  • {{#if: |Brezhoneg| Brezhoneg}}|}}{{#ifexist: {{#if: | | {{#if: Help | Help:}}Transclusion}}/ca |  • {{#if: |Català| Català}}|}}{{#ifexist: {{#if: | | {{#if: Help | Help:}}Transclusion}}/cs |  • {{#if: |Česky| Česky}}|}}{{#ifexist: {{#if: | | {{#if: Help | Help:}}Transclusion}}/da |  • {{#if: |Dansk| Dansk}}|}}{{#ifexist: {{#if: | | {{#if: Help | Help:}}Transclusion}}/de |  • {{#if: |Deutsch| Deutsch}}|}}{{#ifexist: {{#if: | | {{#if: Help | Help:}}Transclusion}}/el |  • {{#if: |Ελληνικά| Ελληνικά}}|}}{{#ifexist: {{#if: | | {{#if: Help | Help:}}Transclusion}}/eo |  • {{#if: |Esperanto| Esperanto}}|}}{{#ifexist: {{#if: | | {{#if: Help | Help:}}Transclusion}}/es |  • {{#if: |Español| Español}}|}}{{#ifexist: {{#if: | | {{#if: Help | Help:}}Transclusion}}/fa |  • {{#if: |فارسی| فارسی}}|}}{{#ifexist: {{#if: | | {{#if: Help | Help:}}Transclusion}}/fi |  • {{#if: |Suomi| Suomi}}|}}{{#ifexist: {{#if: | | {{#if: Help | Help:}}Transclusion}}/fr |  • {{#if: |Français| Français}}|}}{{#ifexist: {{#if: | | {{#if: Help | Help:}}Transclusion}}/gl |  • {{#if: |Galego| Galego}}|}}{{#ifexist: {{#if: | | {{#if: Help | Help:}}Transclusion}}/gu |  • {{#if: |ગુજરાતી| ગુજરાતી}}|}}{{#ifexist: {{#if: | | {{#if: Help | Help:}}Transclusion}}/he |  • {{#if: |עברית| עברית}}|}}{{#ifexist: {{#if: | | {{#if: Help | Help:}}Transclusion}}/hu |  • {{#if: |Magyar| Magyar}}|}}{{#ifexist: {{#if: | | {{#if: Help | Help:}}Transclusion}}/id |  • {{#if: |Bahasa Indonesia| Bahasa Indonesia}}|}}{{#ifexist: {{#if: | | {{#if: Help | Help:}}Transclusion}}/it |  • {{#if: |Italiano| Italiano}}|}}{{#ifexist: {{#if: | | {{#if: Help | Help:}}Transclusion}}/ja |  • {{#if: |日本語| 日本語}}|}}{{#ifexist: {{#if: | | {{#if: Help | Help:}}Transclusion}}/ka |  • {{#if: |ქართული| ქართული}}|}}{{#ifexist: {{#if: | | {{#if: Help | Help:}}Transclusion}}/ko |  • {{#if: |한국어| 한국어}}|}}{{#ifexist: {{#if: | | {{#if: Help | Help:}}Transclusion}}/ksh |  • {{#if: |Ripoarisch| Ripoarisch}}|}}{{#ifexist: {{#if: | | {{#if: Help | Help:}}Transclusion}}/kw |  • {{#if: |Kernowek| Kernowek}}|}}{{#ifexist: {{#if: | | {{#if: Help | Help:}}Transclusion}}/mk |  • {{#if: |Македонски| Македонски}}|}}{{#ifexist: {{#if: | | {{#if: Help | Help:}}Transclusion}}/ml |  • {{#if: |മലയാളം| മലയാളം}}|}}{{#ifexist: {{#if: | | {{#if: Help | Help:}}Transclusion}}/mr |  • {{#if: |मराठी| मराठी}}|}}{{#ifexist: {{#if: | | {{#if: Help | Help:}}Transclusion}}/ms |  • {{#if: |Bahasa Melayu| Bahasa Melayu}}|}}{{#ifexist: {{#if: | | {{#if: Help | Help:}}Transclusion}}/nl |  • {{#if: |Nederlands| Nederlands}}|}}{{#ifexist: {{#if: | | {{#if: Help | Help:}}Transclusion}}/no |  • {{#if: |‪Norsk (bokmål)‬| ‪Norsk (bokmål)‬}}|}}{{#ifexist: {{#if: | | {{#if: Help | Help:}}Transclusion}}/oc |  • {{#if: |Occitan| Occitan}}|}}{{#ifexist: {{#if: | | {{#if: Help | Help:}}Transclusion}}/pl |  • {{#if: |Polski| Polski}}|}}{{#ifexist: {{#if: | | {{#if: Help | Help:}}Transclusion}}/pt |  • {{#if: |Português| Português}}|}}{{#ifexist: {{#if: | | {{#if: Help | Help:}}Transclusion}}/pt-br |  • {{#if: |Português do Brasil| Português do Brasil}}|}}{{#ifexist: {{#if: | | {{#if: Help | Help:}}Transclusion}}/ro |  • {{#if: |Română| Română}}|}}{{#ifexist: {{#if: | | {{#if: Help | Help:}}Transclusion}}/ru |  • {{#if: |Русский| Русский}}|}}{{#ifexist: {{#if: | | {{#if: Help | Help:}}Transclusion}}/si |  • {{#if: |සිංහල| සිංහල}}|}}{{#ifexist: {{#if: | | {{#if: Help | Help:}}Transclusion}}/sk |  • {{#if: |Slovenčina| Slovenčina}}|}}{{#ifexist: {{#if: | | {{#if: Help | Help:}}Transclusion}}/sq |  • {{#if: |Shqip| Shqip}}|}}{{#ifexist: {{#if: | | {{#if: Help | Help:}}Transclusion}}/sr |  • {{#if: |Српски / Srpski| Српски / Srpski}}|}}{{#ifexist: {{#if: | | {{#if: Help | Help:}}Transclusion}}/sv |  • {{#if: |Svenska| Svenska}}|}}{{#ifexist: {{#if: | | {{#if: Help | Help:}}Transclusion}}/ta |  • {{#if: |தமிழ்| தமிழ்}}|}}{{#ifexist: {{#if: | | {{#if: Help | Help:}}Transclusion}}/th |  • {{#if: |ไทย| ไทย}}|}}{{#ifexist: {{#if: | | {{#if: Help | Help:}}Transclusion}}/tr |  • {{#if: |Türkçe| Türkçe}}|}}{{#ifexist: {{#if: | | {{#if: Help | Help:}}Transclusion}}/uk |  • {{#if: |Українська| Українська}}|}}{{#ifexist: {{#if: | | {{#if: Help | Help:}}Transclusion}}/vi |  • {{#if: |Tiếng Việt| Tiếng Việt}}|}}{{#ifexist: {{#if: | | {{#if: Help | Help:}}Transclusion}}/yue |  • {{#if: |粵語| 粵語}}|}}{{#ifexist: {{#if: | | {{#if: Help | Help:}}Transclusion}}/zh |  • {{#if: |中文| 中文}}|}}{{#ifexist: {{#if: | | {{#if: Help | Help:}}Transclusion}}/zh-hans |  • {{#if: |‪中文(简体)‬| ‪中文(简体)‬}}|}}{{#ifexist: {{#if: | | {{#if: Help | Help:}}Transclusion}}/zh-hant |  • {{#if: |‪中文(繁體)‬| ‪中文(繁體)‬}}|}}{{#ifexist: {{#if: | | {{#if: Help | Help:}}Transclusion}}/zh-tw |  • {{#if: |‪中文(台灣)‬| ‪中文(台灣)‬}}|}}
Personal tools
Namespaces
Variants
Actions
Navigation
Installation
Configuration
Administration
Tools
Status
Dialup Replays
Service Monitor
Misc
Toolbox