[dokuwiki] config handling for plugins

  • From: "Esther Brunner" <wikidesign@xxxxxxxxx>
  • To: dokuwiki@xxxxxxxxxxxxx
  • Date: Fri, 24 Feb 2006 15:09:23 +0100

Hello list

I've got a patch ready that adds standard methods to syntax and admin
plugins for accessing configuration variables. Some plugins, as for example
the blog plugin, have their own configuration settings. Until now you had to
edit a textfile conf.php in the plugin's directory. With the functions in
the patch, it will be possible to set these through the config manager
plugin.

For plugin developers, the following files are important:

  * lib/plugins/<plugin>/conf/default.php -- default settings; can be
overridden by settings in conf/local.php
  * lib/plugins/<plugin>/conf/metadata.php -- metadata for the config
manager
  * lib/plugins/<plugin>/lang/<lang>/settings.php -- for localized labels in
the config manager

Internally these settings are put into $conf['plugin'][<plugin>][<key>] =
<value>.

See the new blog plugin I will release later today for an example. Plugins
shouldn't access these files directly. They are handled by the plugin
interface. You access config variables by calling...

$this->getConf(<key>)

It is thus very similar to the way you access language strings:
$this->getLang(<key>).

I'd like to get some opinions from other plugin and template developers. Do
you think this is a good way for handling plugin config variables? And
should we extend this to templates as well (for example, to set whether the
sidebar should on the right or left side)?

-- Esther Brunner

Other related posts: