PhpWiki supports plugins since 1.3.x

WikiPlugins allow one to easily add new types of dynamic content (as well as other functionality) to wiki pages within PhpWiki. In this very wiki, the RecentChanges, BackLinks, LikePages and most other indexing scheme pages are all implemented using plugins.

Sooner or later the old-style phpwiki: MagicPhpWikiURLs will be replaced by plugins too.

Example

Currently, one invokes a plugin by putting something like:

<?plugin BackLinks?>

into a regular wiki-page. That particular example produces as list of pages which link to the current page. Here it is:

16 pages link to WikiPlugin:

(This is great for Category and Topic pages. You can use this to get an automatic in-line listing of pages in the Category or Topic.)

Details

Plugins can take certain named arguments (most do). The values of these arguments can be determined four different ways. In order of precedence:

  1. The plugin invocation can specify the value for an argument, like so:

    <?plugin BackLinks page=OtherPage ?>
  2. The argument can be specified via an HTTP query argument. This doesn't happen (is not allowed) unless the argument is mentioned in the plugin invocation:

    <?plugin BackLinks page ?>
  3. Default values specified in the plugin invocation:

    <?plugin BackLinks page||=OtherPage ?>
  4. The plugin must supply default values for each argument it uses. Such default args may be overriden by URL arguments like so:

      BackLinks?page=ThisPage&sortby=-mtime

    (The BackLinks plugin uses the current page as the default value for the page argument.)

There exist four basic types of plugins:

All this plugins derive from WikiPlugin class extending the run method which returns a object tree of HTML objects, and may react on any provided arguments from the WikiPage (see the args below) or optionally overridden by arguments from the url (GET or POST args) (if defined via '||=').

plugin-form is used to display a input type=text box for the default argument.

plugin-head does not exist anymore. It was used to pass special headers to the HTTP output only, which might be needed for framesets, redirection (RedirectToPlugin) and inserting global javascript. plugin-head is not called inside the body.

plugin-link may be used to change the outgoing links for this page.

<?plugin PluginName [args...] ?>
<?plugin-form PluginName [args...] ?>
<?plugin-link PluginName [args...] ?>
This is not used in any plugin so far.
<?plugin-head PluginName [args...] ?>
This is not used anymore.

Existing Plugins

See PluginManager for the actual list. Most plugins have their own description page with the name Plugin appended.

More Ideas for Plugins


Pages in this category:


PhpWikiDocumentation