[dokuwiki] Re: Template Plugin proposal...

  • From: Chris Smith <chris@xxxxxxxxxxxxx>
  • To: dokuwiki@xxxxxxxxxxxxx
  • Date: Tue, 29 Aug 2006 21:44:38 +0100

Hi Terence,

I think we are talking at cross-purposes here.

The current dokuwiki plugins, action, syntax or admin aren't designed to be able to replace core dokuwiki functionality[1]. It appears to me that you are aiming to be able to do something like class overloading. Dokuwiki plugins can't do that and there is no facility to choose to use one particular set of functions over another. Even if it were feasible to move the template functions to a plugin I don't believe the advantages that you are seeking would materialise.

e.g. If the template functions were in a template. A template would need to instantiate the template plugin object and know which methods to use. The only way to alter those functions would be to write your own template plugin to replace the dokuwiki one using the exact same file, class and variable names. That defeats the purpose of a plugin, as the next time dokuwiki was upgraded it would overwrite your custom template plugin with the upgraded dokuwiki one.

Another issue with admin and syntax plugins is that they are only loaded in response to specific things. Admin plugins through the admin menu - they aren't loaded the rest of the time. Syntax plugins when the dokuwiki parser is instantiated, that generally happens in tpl_content() - well after the beginning of template processing.

What you have described is really what action plugins were designed for. To do things in response to actions taken by dokuwiki. They are loaded all the time. They are loaded very close to the start of dokuwiki, pretty well straight after initialisation. They can be activated by a light weight triggering system, adding another trigger or five would make very little difference to the responsiveness of dokuwiki[2]. The triggers are separated from the hooks that process them. So there is no likelihood of any errors if a trigger isn't fired or if there are no hooks to process a trigger once its fired.

Please feel free to propose events for one or more of the template functions[3]. Or if you would prefer, outline what you are trying to do and ask for assistance in getting an appropriate event added that will allow it to happen.

Cheers,

Chris
[1] Action plugins can replace dokuwiki functionality with appropriately constructed events.
[2] If no action plugins are fired. If they are fired, execution time and memory will depend on the plugin(s).
[3] Action plugins are a very recent addition, they were added with a few events not to restrict the number of events but to avoid adding useless events that noone would ever use. If there is a good use for an event, I don't think anyone would have any objections to it being added.







-- DokuWiki mailing list - more info at http://wiki.splitbrain.org/wiki:mailinglist

Other related posts: