Note: You are currently viewing documentation for Moodle 2.0. Up-to-date documentation for the latest stable version is available here: Transclusion.

MoodleDocs:Transclusion: Difference between revisions

From MoodleDocs
 
(One intermediate revision by the same user not shown)
Line 24: Line 24:
For an example of how this technique can be applied to simplify the creation of [http://en.wikipedia.org/wiki/Wikipedia:SS summary articles], see [http://en.wikipedia.org/wiki/Pathology Pathology], which consists of a collection of transcluded [http://en.wikipedia.org/wiki/Wikipedia:LEAD lead paragraphs] from several main articles.
For an example of how this technique can be applied to simplify the creation of [http://en.wikipedia.org/wiki/Wikipedia:SS summary articles], see [http://en.wikipedia.org/wiki/Pathology Pathology], which consists of a collection of transcluded [http://en.wikipedia.org/wiki/Wikipedia:LEAD lead paragraphs] from several main articles.


==See also==
== See also ==
* [[User:Frank_Ralf/Subpage transclusion]]
* [[User:Frank_Ralf/Subpage transclusion]]
* [http://en.wikipedia.org/wiki/Wikipedia:Transclusion Transclusion at Wikipedia]
* http://en.wikipedia.org/wiki/Wikipedia:Transclusion
 
; Using Moodle forum discussions
* [http://moodle.org/mod/forum/discuss.php?d=176065#p779453 Update on Moodle 2.0 Docs]
* [http://moodle.org/mod/forum/discuss.php?d=169322&parent=742919 Moodle 2+ documentation]
 
; Example
[[NanoGong/Converting to Moodle 2.0]], which actually is a transclusion of [[User:Frank Ralf/NanoGong]]

Latest revision as of 15:57, 19 June 2011


Transclusion displays the content of another page in the current page by inserting a page link preceded by a full colon (for example: {{:Another page}}. These are recognized as templates by MoodleDocs.

This technique was first discovered by MoodleDocers in November 2008. Guidelines for use of this tool will emerge and time goes by.

WARNING:Please use this tool with care because it potentially can impact many other contributors who are not familiar with it's use.

Examples

The first use of transclusion in MoodleDocs was on the Latest release notes page in December 2008.

Test

This text is only part of the text that is located on MoodleDocs talk:Transclusion page. Only this text should appear when {{:MoodleDocs_talk:Transclusion}} is inserted into another page.

Transclusion syntax and markups

  • Insert entire page The template syntax {{:Another page}} inserts an entire page at this point.
  • noinclude. The markup <noinclude>...</noinclude> 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 <includeonly>...</includeonly> 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 <onlyinclude>...</onlyinclude> 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.

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 Pathology, which consists of a collection of transcluded lead paragraphs from several main articles.

See also

Using Moodle forum discussions
Example

NanoGong/Converting to Moodle 2.0, which actually is a transclusion of Frank Ralf/NanoGong