Include Plugin

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.

Tagged with embed, include.

:!: It is recommended to delete all cache files in <dokuwiki>/data/cache directly after upgrading the plugin :!:

Description

This is a handy plugin with which you can include another wiki page into the current one.

Syntax

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).

Configuration

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)

Macros

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}}

Flags

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}}

Demo

You can try the plugin here.

Bugs / Feature Requests

Please report bugs or feature requests at the Bug tracker.

Further Resources

Changes

Discussion

Including page sometimes do not reflect changes in the included page

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.

Attempts to solve the problem

  • Attach ~~NOCACHE~~ to the Including Page.
  • Append ?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.

Example 1

ALL FINE WITH THIS METHOD!

  • Including Page on root namespace.
  • Included Page in same namespace: includetest (Included pagename has no spaces..):

Link syntax to Included Page contains no spaces (since the pagename also does not):

{{page>includetest}}

page_includetest

Example 2

THIS METHOD DOES NOT UPDATE CORRECTLY THE INCLUDING PAGE!

  • Including Page on root namespace.
  • Included Page in same namespace: included test page (Included pagename has spaces):

Link syntax to Included Page contains spaces (which were not replaced by _):

{{page>included test page}}

page_included_test_page

Example 3

ALL FINE WITH THIS METHOD!

  • Including Page on root namespace.
  • Included Page in same namespace: included test page 2 (Included pagename has spaces):

Link syntax to Included Page contains no spaces (and all are replaced by _):

{{page>included_test_page_2}}

page_included_test_page_2

Example 4

THIS METHOD DOES NOT UPDATE CORRECTLY THE INCLUDING PAGE!

THIS METHOD DOES NOT EVEN DISPLAY A LINK TO THE INCLUDING PAGE!!!

  • Including Page not on root namespace: E.g., playground.
  • Included Page in same namespace: includetest (Included pagename has no spaces..):
  • Included Page is referred by its absolute path (from root), and not its relative path (just its name, in this case)

Link syntax to Included Page contains no spaces (since the pagename also does not):

{{page>:playground:includetest}}

includetest

Example 5

THIS METHOD DOES NOT UPDATE CORRECTLY THE INCLUDING PAGE!

THIS METHOD DOES NOT EVEN DISPLAY A LINK TO THE INCLUDING PAGE!!!

  • Including Page not on root namespace: E.g., playground.
  • Included Page in same namespace: included test page 2 (Included pagename has spaces):
  • Included Page is referred by its absolute path (from root), and not its relative path (just its name, in this case)

Link syntax to Included Page contains no spaces (and all are replaced by _):

{{page>:playground:included_test_page_2}}

included_test_page_2

Example 6

THIS METHOD DOES NOT UPDATE CORRECTLY THE INCLUDING PAGE!

  • Including Page not on root namespace: E.g., playground.
  • Included Page in other namespace: includetest (Included pagename has no spaces..):

Link syntax to Included Page contains no spaces (since the pagename also does not):

{{page>:wiki:includetest}}

includetest

Example 7

THIS METHOD DOES NOT UPDATE CORRECTLY THE INCLUDING PAGE!

  • Including Page not on root namespace: E.g., playground.
  • Included Page in other namespace: included test page 2 (Included pagename has spaces):
  • Relative path to Included Page (..:)

Link syntax to Included Page contains spaces (not replaced by _):

{{page>:playground:included test page}}

included_test_page

Example 8

THIS METHOD DOES NOT UPDATE CORRECTLY THE INCLUDING PAGE!

  • Including Page not on root namespace: E.g., playground.
  • Included Page in other namespace: included test page 2 (Included pagename has spaces):
  • Relative path to Included Page (..:)

Link syntax to Included Page contains no spaces (all are replaced by _):

{{page>..:wiki:included_test_page_2}}

included_test_page_2

Conclusion

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

  • Both on a home Ubuntu 9.10 server, and on a commercial site5 server.

Is this the intended behaviour?

Can we include pages from other namespaces?

  • If not, can someone change the plugin so that it does? This is a very important and fundamental plugin, it should not give limitations like this ;)

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

1) This syntax is considered experimental!
 
plugin/include.txt · Last modified: 2010/02/05 19:58 by 74.93.99.97
 
Except where otherwise noted, content on this wiki is licensed under the following license:CC Attribution-Noncommercial-Share Alike 3.0 Unported
Imprint Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki
WikiForumIRCBugsGitXRefTranslate