Difference between revisions of "Transclusion"
(New page: == Executive Summary == Transclusion in MediaWiki is the same as an 'include' in PHP programming, or an entity in XML, or a remote server image in an HTML page. If you have a long page, y...) |
(Document attempts at transcluding from remote wikis) |
||
Line 12: | Line 12: | ||
<nowiki>{{:Article Name}}</nowiki> | <nowiki>{{:Article Name}}</nowiki> | ||
Note: since templates have their own 'template' namespace while regular articles are in the default namespace and thus use a preceding colon | Note: since templates have their own 'template' namespace while regular articles are in the default namespace and thus use a preceding colon | ||
+ | |||
+ | == Transcluding from Other Wikis == | ||
+ | According to [[mw:Manual:$wgEnableScaryTranscluding]], you can enable 'scary transclusion' (and as long as the interwiki table is in accordance), you can include templates and article content from remote wikis. However, my tests could not get this to work. I tried multiple variations. | ||
+ | ;using 'raw' and the 'wp' interwiki prefix to grab the POTD template:<nowiki>{{raw:wp:POTD/{{#time:Y-m-d}}|image}}</nowiki> | ||
+ | ;using the 'commons' interwiki link:<nowiki>{{commons:Potd|width=300|float=right|lang=en}}</nowiki> | ||
+ | ;with magic words:<nowiki>{{commons:Potd/{{CURRENTYEAR}}-{{CURRENTMONTH}}-{{CURRENTDAY2}}}}</nowiki> | ||
+ | ;using a <code>file:</code> approach with 'subst(itution)' and 'raw':<nowiki>[[File:{{subst:raw:commons:Potd/{{CURRENTYEAR}}-{{CURRENTMONTH}}-{{CURRENTDAY2}}}}]]</nowiki> | ||
+ | Tests of Transcluding the Python page from wikipedia.org | ||
+ | *<nowiki>{{w::Python}}</nowiki> | ||
+ | *<nowiki>{{subst:w::Python}}</nowiki> | ||
+ | *<nowiki>{{raw:w::Python}}</nowiki> | ||
== See Also == | == See Also == |
Latest revision as of 12:58, 21 January 2016
Executive Summary[edit | edit source]
Transclusion in MediaWiki is the same as an 'include' in PHP programming, or an entity in XML, or a remote server image in an HTML page.
If you have a long page, you may want to break up the topic into sub-topics and then transclude the smaller articles into the super article.
Definition[edit | edit source]
Syntax[edit | edit source]
Tranclusion syntax is the same as Templates syntax (i.e. double curly braces: {{:Article Name}} Note: since templates have their own 'template' namespace while regular articles are in the default namespace and thus use a preceding colon
Transcluding from Other Wikis[edit | edit source]
According to mw:Manual:$wgEnableScaryTranscluding, you can enable 'scary transclusion' (and as long as the interwiki table is in accordance), you can include templates and article content from remote wikis. However, my tests could not get this to work. I tried multiple variations.
- using 'raw' and the 'wp' interwiki prefix to grab the POTD template
- {{raw:wp:POTD/{{#time:Y-m-d}}|image}}
- using the 'commons' interwiki link
- {{commons:Potd|width=300|float=right|lang=en}}
- with magic words
- {{commons:Potd/{{CURRENTYEAR}}-{{CURRENTMONTH}}-{{CURRENTDAY2}}}}
- using a
file:
approach with 'subst(itution)' and 'raw' - [[File:{{subst:raw:commons:Potd/{{CURRENTYEAR}}-{{CURRENTMONTH}}-{{CURRENTDAY2}}}}]]
Tests of Transcluding the Python page from wikipedia.org
- {{w::Python}}
- {{subst:w::Python}}
- {{raw:w::Python}}
See Also[edit | edit source]
The wikipedia manual of style talks about how to deal with wp:Wikipedia:Article size The wp:Wikipedia:Summary style article goes into more detail and there are related articles in the style guide also.