Translations of this page?:

Plugin File Structure

There are two structures for the files of a DokuWiki plugin class. The structure chosen determines the name for the plugin class(es).

  1. <dokuwiki>/lib/plugins/<plugin name>/<plugin type>.php
    the plugin class name will be <plugin type>_plugin_<plugin name>
    e.g. file                                     class
         <dokuwiki>/lib/plugins/acl/admin.php  => admin_plugin_acl
    


  2. <dokuwiki>/lib/plugins/<plugin name>/<plugin type>/<filename>.php
    This structure allows several plugin classes of one plugin type within one plugin, the class names will be <plugin_type>_plugin_<plugin name>_<filename>,
    e.g. file                        type                 class
         <dokuwiki>/lib/plugins/code/syntax/code.php   => syntax_plugin_code_code
         <dokuwiki>/lib/plugins/code/syntax/file.php   => syntax_plugin_code_file
    


Note that an _ (underscore) is a reserved character and cannot be use in the <plugin name>.

A plugin may contain several different plugins types as well as several different plugin classes of each type.

In addition, a plugin can (optionally) take advantage of other built-in facilities to have its styles, JavaScript, localisation, and configuration included in DokuWiki.

All paths and files are relative to the plugin root directory.

  • <dokuwiki>/lib/plugins/<pluginname>/
    • style.cssCSS styles for the plugin
    • script.jsJavaScript used by the plugin
    • lang/<language>/lang.php – English language strings (accessible via $this→getLang())
    • lang/<language>/settings.php – localised strings used in the configuration manager
    • lang/<language>/<filename>.txt – localised text including DokuWiki markup (accessible via $this→locale_xhml())
    • conf/default.phpdefault settings (accessible via $this→getConf(), local settings are added to DokuWiki's global <dokuwiki>/conf/local.php)
    • conf/metadata.phpconfiguration metadata describing the settings for use by configuration manager

How to include more than one JavaScript file?

DokuWiki supports a special include syntax which can be used to source other files in a JavaScript file.

How to include more than one CSS file

The CSS should be merged into one file.

 
devel/plugin_file_structure.txt · Last modified: 2008/10/28 00:35 by 70.103.232.219
 

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