Include another wiki page into the current one. (previous authors: Michael Klier, Esther Brunner)
Compatible with DokuWiki
Security warning (please read plugin security guidelines): This plugin can expose information of included pages hidden by ACLs through the backlinks feature and other plugins using the metadata search index (currently I'm not aware of any).
Similar to composer, displaywikipage, embed, includeuserpage, pagebox, tabinclude, templater
It is recommended to delete all cache files in <dokuwiki>/data/cache directly after upgrading the plugin from an old version (before 2011)
WARNING: Since the 2011-05-25 “Rincewind” release of DokuWiki, information disclosure through the backlinks feature and possibly other plugins that use the metadata search index is possible. You can be able to see backlinks from an included page although you must not see them. I (michituxMichael Hamann
michitux
Karlsruhe, Germany) still don't know how to fix that properly without breaking other things so currently no update for that issue is planned.
This is a handy plugin with which you can include another wiki page into the current one. Just including certain sections of a page or even whole namespaces is supported, too.
Install the plugin using the Plugin Manager and the download URL above, which points to latest version of the plugin. Refer to Plugins on how to install plugins manually.
If you need support for older version of DokuWiki you can try the 2009-11-27 version of the include plugin, but please note that this old version has known bugs. If you need support for older versions of DokuWiki in the current include plugin version please open a feature request in the issue tracker.
{{page>wiki:syntax#Tables}} will include the section about tables of the syntax page.
{{namespace>project_foo}} will include all pages in the project_foo namespace.
{{page>blog:mypage&tags&comments}} will include the page blog:mypage and show the tags from the tag plugin and the number of comments from the discussion plugin. Both plugins need to be installed for this example.
Simply enclose the ID of the page to be included in double curly brackets:
{{page>[id]&[flags]}}
{{section>[id]#[section]&[flags]}}
{{namespace>[namespace]&[flags]}}
{{tagtopic>[tag]&[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 |
| [tag] | include pages with tag topic tag, requires plugin:tag | required |
| [flags] | flags delimited by &, see flags | optional |
The plugin offers four syntaxes, {{page>...}} , {{section>...}} , {{namespace>...}} and {{tagtopic>...}}.
Section is aimed more at including sections, page at including whole pages and namespace at including whole namespaces. Tagtopic includes all pages with a tagtopic tag.
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 |
doredirect | Redirect back to original page after an edit |
usernamespace | Namespace for user pages (see showuser configuration) (default user) |
doindent | Indent included pages relative to the section of the page they get included in |
linkonly | Display only a link instead of the whole page content |
title | Show the title instead of the page id |
pageexists | Only list page ids of existing pages (see existlink) |
existlink | Display a link and do so only if page page-id exists |
noparlink | Don't put the link into a par environment (for inline lists) |
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 |
| @WEEK@ | 2-digit ISO week number |
| @DAY@ | 2-digit day |
| @DATE<expr>@ | use a calculated date instead of today in date macros |
<expr> in @DATE<expr>@ can be one of:
| PYEAR | previous year |
|---|---|
| NYEAR | next year |
| PMONTH | previous month |
| NMONTH | next month |
| PWEEK | previous week |
| NWEEK | next week |
| YESTERDAY | yesterday's date |
| TOMORROW | tomorrow's date |
Examples:
{{page>@MONTH@:@DAY@:birthdays}}
includes the page birthdays in namespace <month>:<day>: eg. 10:15: birthdays for the 15th of october.
{{page>@USER@:message}}
incudes the page message from the namespace <user> of the logged in user
{{page>foo@DATENWEEK@@YEAR@:@WEEK@}}
includes the page <weekno> from the namespace foo<year> with next week's date e.g. foo2012:01 for the 27th of december 2011
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 |
noindent | fullpage | page section and header retained on the same level as source page | noheader | strips the title from the included page |
Examples:
{{page>concept&firstseconly&footer}}
{{page>mypage&noindent}}
There is currently no demo site available.
* http://wp.imgre.ru (including blog page)
Please report bugs or feature requests at the Bug tracker.
There are currently no known bugs and issues for which no workarounds exist (see FAQ).
This can be solved by using the inline flag of the include plugin. This mode strips all section from the included page and should solve issues with invalid HTML and thus no longer working wrap and folded plugins. When the page contains headers this might look strange depending on the template.
Yes, this is possible since the 2011-01-01 version and hasn't been possible before. But you can't include the same page again inside a page in order to avoid endless recursion (and things like page1 > page2 > page1 doesn't work, too).
Yes and no. The include plugin does respect ACLs of the included pages. Whenever the view or edit permissions change the cache is purged and the included pages are adapted according to the current permissions. However when ACLs are really important you should try it if it really works as expected and otherwise please report a bug. Since the 2011-05-25 “Rincewind” release of DokuWiki information of included page might be included in the search index that should not be visible to some users. This means that users might see a backlink from a page with an included page although they don't have permissions to view that included page.
This is done because if there are headers in the included page they will close the current section. As the include plugin has its own container div this would produce strange results and possibly invalid HTML. You can use the inline flag in order to avoid this (but then also all sections of the included page are removed).
Please don't report any bugs or feature requests here but instead use the bug tracker!
If you miss a comment you've created please have a look at the FAQ section and the issue tracker, I might have moved them there, if you can't find a bug report anymore that bug should be solved, please try the current version and report it again if it still doesn't work.
footer.php:
// author if ($flags['user']) { $author = $meta['creator']; if ($author) { $userpage = cleanID($this->getConf('usernamespace').':'.$author);
replaced to include the real user name in the link:
// author if ($flags['user']) { $author = $meta['creator']; $login = $meta["last_change"]['user']; if ($author) { $userpage = cleanID($this->getConf('usernamespace').':'.$login);
Hi, I'm using userpagecreate plugin's to create user's namespace instead of user's page. Then, to link correctly the include's page with his last member who edit it, i rewrite the previous lines like this :
if ($flags['user']) { $login = $meta['last_change']['user']; $author = $auth->getUserData($login); $author = $author['name']; if ($author && $login) { if (strstr($this->getConf('usernamespace'), '@USER@')) { $userpage = cleanID(str_replace('@USER@', $login, $this->getConf('usernamespace'))); } else { $userpage = cleanID($this->getConf('usernamespace').':'.$login); } resolve_pageid(getNS($ID), $userpage, $exists); $class = ($exists ? 'wikilink1' : 'wikilink2'); $link = array( 'url' => wl($userpage), 'title' => $userpage, 'name' => hsc($author), 'target' => $conf['target']['wiki'], 'class' => $class.' url fn', 'pre' => '<span class="vcard author">', 'suf' => '</span>', ); $xhtml[] = $renderer->_formatLink($link); } }
and change my conf into :
$conf['plugin']['include']['usernamespace'] = 'user:@USER@:start';
standard configuration still works.
$conf['plugin']['include']['usernamespace'] = 'user:';
If the @USER@ wildcard is using, replace it by the login name, otherwise, use the standard include's plugin rule.
— garlikgarlik
France 2011/10/24 14:10
— garlikgarlik
France 2011/11/07 11:32 - Summmary : Update the code. will display the right modif author.
When including a page, the flag to make the first heading a link is link, not showlink. This confused me at first because I assumed the flags would have the same names as the configuration options. Example (displays the first section of a product page, with the page heading as a link):
{{page>products:sample&firstseconly&link}}
By default, the headers in included pages start one level lower than the last header in the current page. For example, if the section before the include is a level-three header, then a level-6 header in the included page will become a wimply little level-2.
If you want higher-level headers, you can trick the plugin by putting an empty header above the include. In the following example, a level-6 header in the included page will show up as level-5:
=== Some Section ===
Stuff
====== ======
{{page>somepage}}
See the Hidden Header plugin. -Ziothzioth
Zioth