include plugin by Gina Häußge, Michael Klier
Include another wiki page into the current one. (previous authors: Esther Brunner)
Last updated on 2009-11-27. Provides Syntax, Helper.
Compatible with DokuWiki 2009-02-14, 2008-05-05.
Similar to composer, displaywikipage, embed, includeuserpage, tabinclude, templater.
It is recommended to delete all cache files in <dokuwiki>/data/cache directly after upgrading the plugin
This is a handy plugin with which you can include another wiki page into the current one.
Simply enclose the ID of the page to be included in double curly brackets:
{{page>[id]#[section]&[flags]}}
{{section>[id]#[section]&[flags]}}
{{namespace>[namespace]&[flags]}}
| [id] | page ID of the page to include; some macros are possible; shortcuts are resolved (:, ., ..) | required |
|---|---|---|
| [section] | limits the included page to a specific section and its subsections | optional; default is the whole page |
| [flags] | flags delimited by &, see flags | optional |
The plugin offers three syntaxes, {{page>...}} and {{section>...}} and {{namespace>...}}.
Section is aimed more at including sections, page at including whole pages and namespace at including whole namespaces1).
The plugin can be configured in the DokuWiki configuration manager available in the admin menu. These settings also affect the blog plugin which uses the include plugin to generate the blog page.
noheader | Don't display the header of the inserted section |
|---|---|
firstseconly | Display only the first section of the included page |
showtaglogos | Show/hide an image for the first tag (if the page has tags) |
showfooter | Show/hide page footer below the included page |
showlink | Makes the first headline of a included page/section a link to the included page/section |
showpermalink | Show/hide a permalink to the included page in the page footer |
showdate | Show/hide creation date of the page in the page footer |
showuser | Show/hide user name of the page creator in the page footer |
showcomments | Show/hide number of comments in the page footer (requires the discussion plugin) |
showlinkbacks | Show/hide number of linkbacks in the page footer (requires the linkback or backlinks2 plugin) |
showtags | Show/hide tags in the page footer (requires the tag plugin) |
showeditbtn | Show/hide edit button below the included page |
usernamespace | Namespace for user pages (see showuser configuration) (default user) |
Simple macros are possible to serve a page on a per user or per date base. These are:
| @USER@ | username |
|---|---|
| @NAME@ | full name of user |
| @GROUP@ | first group the user belongs to |
| @YEAR@ | 4-digit year |
| @MONTH@ | 2-digit month |
| @DAY@ | 2-digit day |
Examples:
{{page>@MONTH@:@DAY@:birthdays}}
{{page>@USER@:message}}
You may use flags to override default all configuration settings:
| Setting | Default | Alternative | ||
|---|---|---|---|---|
firstseconly | fullpage | includes the whole page | firstseconly | includes only the first section of a wiki page |
showfooter | footer | shows a footer below the page with info about the included page | nofooter | hides the page info footer |
showeditbtn | editbtn | shows a button to edit (or create) the included page | noeditbtn | hides the edit (or create) button |
| etc | etc | etc | noheader | strips the title from the included page |
Example:
{{page>concept&firstseconly&footer}}
You can try the plugin here.
Please report bugs or feature requests at the Bug tracker.
The include plugin sometimes behaves strangely: The including page does not reflect the changes on the included page (unless you edit and save the including page). This is because what is displayed is the cached version of the including page. DokuWiki believes that nothing was changed, and so it does not refresh the cache.
Below are some include test, to pages in the same namespace, and other namespaces.
I wonder if this is the intended behaviour, or its just happening for some users.
?purge=1 to the Including Page URL and load the page - then edit the Included Page and change something. None of the above worked for me: I cannot include pages from other namespaces.
ALL FINE WITH THIS METHOD!
Link syntax to Included Page contains no spaces (since the pagename also does not):
{{page>includetest}}
THIS METHOD DOES NOT UPDATE CORRECTLY THE INCLUDING PAGE!
Link syntax to Included Page contains spaces (which were not replaced by _):
{{page>included test page}}
ALL FINE WITH THIS METHOD!
Link syntax to Included Page contains no spaces (and all are replaced by _):
{{page>included_test_page_2}}
THIS METHOD DOES NOT UPDATE CORRECTLY THE INCLUDING PAGE!
THIS METHOD DOES NOT EVEN DISPLAY A LINK TO THE INCLUDING PAGE!!!
Link syntax to Included Page contains no spaces (since the pagename also does not):
{{page>:playground:includetest}}
THIS METHOD DOES NOT UPDATE CORRECTLY THE INCLUDING PAGE!
THIS METHOD DOES NOT EVEN DISPLAY A LINK TO THE INCLUDING PAGE!!!
Link syntax to Included Page contains no spaces (and all are replaced by _):
{{page>:playground:included_test_page_2}}
THIS METHOD DOES NOT UPDATE CORRECTLY THE INCLUDING PAGE!
Link syntax to Included Page contains no spaces (since the pagename also does not):
{{page>:wiki:includetest}}
THIS METHOD DOES NOT UPDATE CORRECTLY THE INCLUDING PAGE!
Link syntax to Included Page contains spaces (not replaced by _):
{{page>:playground:included test page}}
THIS METHOD DOES NOT UPDATE CORRECTLY THE INCLUDING PAGE!
Link syntax to Included Page contains no spaces (all are replaced by _):
{{page>..:wiki:included_test_page_2}}
For the tested installations it was not possible to include pages on different namespaces.
Tested installations: * DokuWiki “rc2009-12-02 Mulled Wine” with several other plugins installed, Apache, PHP
Is this the intended behaviour?
Can we include pages from other namespaces?
In response to all the above, I am able to include a page from another namespace in my wiki. I have ~~NOCACHE~~ in the included page and used '&purge=true' to get the receiving page to load correctly. My included page has underscores, as does my link syntax. This is a Xampplite server running on windows and browsing with Firefox portable. — andrew - 2010-02-05