Include In Context Macro
Last modified by Vincent Massol on 2024/07/05 17:46
Include a document which will be rendered in the context of the current document. |
Type | Doc (Velocity Macro) |
Category | |
Developed by | |
Rating | |
License | GNU Lesser General Public License 2.1 |
Table of contents
Description
This macro renders the specified XWiki page in the context of the top level including document. If I create a DocumentA with content $doc.getName() then I create a document called DocumentB with content #includeInContext("DocumentA") When I view DocumentB the output will be DocumentB. To render a document in it's own context, use Include Topic Macro instead.
This macro will include the content of another page for viewing but if the user is editing the page in "inline mode", the page will not be included. This differs from the Include Form Macro which includes the document in inline edit mode as well.
Usage
#includeInContext("SpaceName.PageName")
Parameters definition
Name | Optional | Allowed values | Default value | Description |
---|---|---|---|---|
pageName | no | a string | none | A page name using the syntax described below |
The pagename parameter may take the following form:
[wiki:][space.]page
where optional parts are surrounded by brackets
- If wiki is present, the space and page parts will refer to a document in the specified wiki in the context of an XWiki farm.
- If space is present, then it will be used as part of the full page name, otherwise the space name of the enclosing document will be used
Example
#includeInContext("dev:Community.IRC")
Equivalent Example Using Modern Include Macro
{{velocity}}
#if($xcontext.getAction() == "view")
{{include document="dev:Community.IRC" /}}
#end
{{/velocity}}
#if($xcontext.getAction() == "view")
{{include document="dev:Community.IRC" /}}
#end
{{/velocity}}