Translations of this page?:

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 2008-07-07. Provides Syntax, Helper.
Compatible with DokuWiki 2008-05-05.

Similar to composer, display_wiki_page, embed, includeuserpage, tabinclude, templater.

Tagged with embed, include.

Download

Description

This is a very simple yet 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]}}
[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 it's subsections optional; default is the whole page
[flags] flags delimited by &, see flags optional

The plugin offers two syntaxes, {{page>...}} and {{section>...}}.

  • page doesn't attempt to merge indentation, allowing the include to be used within other block syntax modes - e.g. folded or boxes. Don't use multiple instances of {{page>...}} in the same section as it will cause indention problems.
  • section will attempt to align the include information with the current indentation level, allowing sections to be included seemlessly. This should only be used in plain DokuWiki markup as it will result in invalid XHTML if used within other blocks.

Section is aimed more at including sections and page at including whole pages, however both can be used to include whole pages or individual sections. The key difference is how they will interact with sections and block syntax modes on the host wiki page.

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.

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

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

Demo

You can try the plugin here.

Bugs

Please report bugs at the Bug Tracker.

Further Resources

Changes

Discussion

When page is fetched from cache TOC is generated incorrectly. Filled a bugrequest about that, but I have a question – any hotfix for this (instead of using nocache)?

I'm having the same problem as above but ?purge=true & NOCACHE don't solve the issue. thomas@wingate.se

How could be used the plugin not into au wiki page but into a php template ?

BUG: the noeditbtn and nofooter flags do not work with nesting (ie, page within a page). Not sure what level of nesting creates the problem, however, what I have is 3 levels of nesting/inclusion, and on the top level I am still seeing edit buttons, even with &noeditbtn and &nofooter.

BUG: Fatal error: Call to a member function getUserData() on a non-object in …./lib/plugins/include/syntax/include.php on line 185

The code makes an assumption that the code is being called via a web interface. I have an application that updates wiki pages dynamically, using the dokuwiki cli tool ”/bin/dwpage.php” …. This script of course does not supply any details in the $_SERVER variables, and thus the error is generated.

This line (and the one before it) is shown below.
$user     = $_SERVER['REMOTE_USER'];
$userdata = $auth->getUserData($user);
Not a bug in the plugin but with dwpage.php. dwpage.php should set $_SERVER['REMOTE_USER'] in order to play well with plugins that honor permissions. — Michael Klier 2008/07/31 11:18

—-

I'm completely lost. I've gone up and down this page like a dozen times and I can't, for the life of me, find where the hell does one download the thing. Gazillions of changelog and resources and email links and descriptions and discussions, and not one download link. Unless it's staring me in the face and I just don't see it. If that's the case, would it be much to ask for a noticeable title “Download”, to make the link more obvious? BTW, I already have this plugin; been using it for a year at least; but the update button tries to update from a dead url.

EDIT: DAMN! It WAS staring me in the face; I guess my eyes were looking for a standard-looking link rather than a button and a box… It would help, though, to put that Download button under a big Download title. Maybe I'll do so myself; this is a wiki, afterall. (Done!) Got another problem now: I give the Plugin Manager the url to the tgz file, and it says “No plugins found, or there has been an unknown problem during downloading and installing.”

EDIT2: I downloaded the plugin manually, extracted it, compressed it as a zip; mirrored it in my server at http://deeplayer.com/mirror/include/plugin-include.zip, and I still get the same problem.

EDIT3: I uploaded the plugin using FileZilla, and it seems to be working except that at the top of each page I get a whole bunch of “Warning: Missing argument 2 for renderxhtml() in …/lib/plugins/include/helper.php on line 203” messages. See: http://wcpedia.com/dw/doku.php/wc_info/factions/clans_kilrathi/vakka/index

The plugin is, atm, not very forgiving in case you include a section that doesn't exist (that might be the problem). — Michael Klier 2008/08/03 17:15

Thanks for the quick reply. The pages do exist, though; and the inclusions show correctly. Has the syntax changed, perhaps? This an example of what I do:

{{page>:z:as:q:p009p1}}

If I browse there, I get there, except there's a similar warning at the top of the page: http://wcpedia.com/dw/doku.php/z/as/q/p009p1

Could it be because I'm nesting inclusions? This included page includes another:

{{page>:z:as:by}}

Which is the book reference footer: http://wcpedia.com/dw/doku.php/z/as/by

What I'm doing is, I have a few hundred quotations from each of the 7 Wing Commander novels, and one file for each book with the book reference. The quotations may be used in more than one page; that's why they are used with the include plugin; but the book reference is a file included by all the quotations from a given book. And the book reference file uses the styler plugin within it:

<epigraph>
**Action Stations**\\
//by William R. Forstchen//\\
Baen Books\\
Copyright (C) 1998 by Origin Systems Inc.\\
[[http://www.amazon.com/s/url=search-alias%3Dstripbooks&field-keywords=Action+Stations&Go.x=0&Go.y=0&Go=Go|find Action Stations in Amazon]]
</epigraph>

Could it be a bad interaction with styler?

EDIT: Confirmed. This is a problem with nested inclusion. I copied the book reference contents from the edit window and pasted them on the first book quotation file included in the first page, and two of the 16 warnings went away. Could you tell me if this bug (I assume) could be fixed easily? Because I could paste the book reference into all the quotations to get around the problem, but this would take me many days of work; I'd rather wait if a fix would be forthcoming. TIA.

Hmmm, might be a bug, could you please open a bug report at the bug tracker (linked on this page), including information how many levels of nested includes you have etc.? Thx. — Michael Klier 2008/08/04 11:28

Done. I forgot to set severity as high. Even though probably few users are nesting includes, for those who do, having warnings appear in all pages is rather severe :) Thanks.


Hi. I'm using the firstseconly flag and was wondering how i could prevent the “read More” link if there are subsections of the selected section that should not be displayed. I added a flag noreadmore that removes the “read More” link under the include.
Here is the patch for helper.php — Martin Heinemann 2008/08/22 14:46

--- helper_old.php      2008-07-07 20:50:33.000000000 +0200
+++ helper.php  2008-08-22 15:04:16.000000000 +0200
@@ -43,6 +43,7 @@
         $this->footer   = $this->getConf('showfooter');
         $this->noheader = 0;
         $this->permalink = 0;
+        $this->readmore = 1;
         $this->header   = array();
     }
 
@@ -193,6 +194,9 @@
                 case 'nopermalink':
                     $this->permalink = 0;
                     break;
+                case 'noreadmore':
+                    $this->readmore = 0;
+                    break;
             }
         }
     }
@@ -469,9 +473,12 @@
         if ($more) {
             array_unshift($this->ins, array('document_start', array(), 0));
             $last = array_pop($this->ins);
-            $this->ins[] = array('p_open', array(), $last[2]);
-            $this->ins[] = array('internallink',array($this->page['id'], $this->getLang('readmore')),$last[2]);
-            $this->ins[] = array('p_close', array(), $last[2]);
+            // check if the readmore Link should be suppressed
+            if ($this->readmore == 1) {
+                $this->ins[] = array('p_open', array(), $last[2]);
+                $this->ins[] = array('internallink',array($this->page['id'], $this->getLang('readmore')),$last[2]);
+                $this->ins[] = array('p_close', array(), $last[2]);
+            }
             $this->ins[] = $last;
             $this->ins[] = array('document_end', array(), $last[2]);
         } else {

Berteh 2008/10/22 Is there any means to include all pages of a given namespace? or all pages of a whole wiki? I want to use it in combination with ODT export so any hint is welcome, including fixing relative linking in this *exported* page.


For both the monobook and sidebar themes, using phpinc messes up the sidebar column formatting, pushing the content below the main column in monobook and placing the footer on top in the sidebar theme. This is in Forefox 3. Do you have any fixes for this?

thanks

skarred — 2008-10-29


 
plugin/include.txt · Last modified: 2008/11/10 13:25 by 88.72.211.224
 

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
WikiForumIRCBugsTranslate