[dokuwiki] Re: Template Plugin proposal...

  • From: Chris Smith <chris@xxxxxxxxxxxxx>
  • To: dokuwiki@xxxxxxxxxxxxx
  • Date: Wed, 30 Aug 2006 04:11:14 +0100

I have looked at the plugin and read the thread. ;)

My earlier point is that you don't need a code.php, use action.php which will save you one line in your template and if you use a decide to a event handler it'll save you the function_exists as well. If you want to have an additional admin.php to provide instructions on use that is up to you. A plugin can include any number of components of any of the plugin types, syntax, admin or action.

You haven't anywhere explained the advantages of following your suggestion. I can see that it may be sensible to split template.php into those functions which call the template and those which are called from the template. However I don't see what advantages accrue, apart from organisation neatness, from having done that.

If you go back a long way in the mailing list, you'll find a discussion on the merits of template plugins. While that may not be what you are after, the discussion highlighted that template writers are expected to be competent php exponents. If they need to include extra functions or to extend dokuwiki functions they can do so by including other files within their templates which do that, just as you have done with monobook. They don't need a special interface.

But as I keep trying to point out, Dokuwiki already has the mechanisms to extend template functions. They just need to be used. e.g. to add button types and new action links, an event handled similarly to template actions and TPL_ACT_UNKNOWN would do the trick.

e.g.

tpl_button($type) {
...
switch($type) {
...
default:
 trigger_event('TPL_BTN_UNKNOWN',$type,btnerror);

similarly for 'TPL_ACTIONLINK_UNKNOWN'.

In fact it makes a lot of sense to add these two. That way one handler can process the action, produce any content required and generate the buttons. The argument against their implementation, is that it requires the template author to modify the template by hand to put the buttons into the template. Code modifications by hand sort of defeat the purpose of plugins.

Cheers,

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

Other related posts: