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-07-01. Provides Syntax, Helper.
Compatible with DokuWiki 2009-02-14, 2008-05-05.
Similar to composer, display_wiki_page, embed, includeuserpage, tabinclude, templater.
| Download | plugin-include.tgz |
|---|
This is a very simple yet 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]}}
| [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 two syntaxes, {{page>...}} and {{section>...}}.
Section is aimed more at including sections and page at including whole pages.
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 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 settings of the firstseconly and showfooter options:
| 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 |
| - | - | - | 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.
Hi. I wanted a @WEEK@ macro, so just after
'@DAY@' => date('d'),
I added :
'@WEEK@' => date('W'), // Delcombel, week, 2009/05/07
It works fine.
Now, I would like to use @YEAR@#@WEEK@ (just 1 section), but I can't find where to patch. Of course I can use @YEAR@:@WEEK@ (which works), but that means I'll have a lot of (very small) files to manage. So, could you patch your code or someone could give here a patch? Thanks.
Yann Delcombel 2009/05/07 14:00
Could anybody confirm that I am right? The included page parsed before it included into the page so the relative links like
[[..:]]
are relative to the template and not the page which includes the template?
Note: The include behavoir has changed. In the 2008-07-07 version the pagename of the page being included was that of the file being included. In the 2009-07-01 release (I'm not sure about intermediate versions) the pagename of the included page is the same as that of the page that makes the inclusion (i.e. if :ns1:page1 includes :ns1:ns2:page2, then in the 2008-07-07 version page2 has a pagename of :ns1:ns2:page2, but in the 2009-07-07 version it is :ns1:page1). This means that the use of relative pagenames will need changing for the different releases. Also, including a page that uses relative pagenames to include other pages will not work if it is included from multiple pages that are not in the same namespaces because the starting point for the relative inclusion will be different.
I need actual examples for everyday humans.
{{page>[id]#[section]&[flags]}}
{{section>[id]#[section]&[flags]}}
This stuff doesn't work as I expect:
{{mypage}}
{{namespace:mypage}}
{{namespace:mypage#section}}
Looking at the examples, I don't know how to include something from another namespace. But if I keep it simple, I would expect this stuff to work:
{{page>[id]#[section]&[flags]}}
It seems like I could do this
{{mypage>}}
Nope, there's something called a “page id” which is required. But there's no example and no explanation. Ummm…
{{mypage>mypage}}
.. I have no clue.
What else do you need than the link to the demo which contains real examples?
Sorry, but it does work as in examples above : the ID is the page you want to include. A real case for me :
{{page>:calendrier:@YEAR@&noheader}} -> the page is :calendrier:2009 (page 2009 of NameSpace calendrier).
For sections, it seems there's a bug if the section is the last one (the whole page is included, as if there were no #section).