[dokuwiki] Re: Plugins that "run once"...

  • From: Chris Smith <chris@xxxxxxxxxxxxx>
  • To: dokuwiki@xxxxxxxxxxxxx
  • Date: Fri, 07 Jul 2006 09:40:17 +0100

Ben Coburn wrote:


If you want to call a method on the plugin object, it becomes a little more complicated. This will give the method access to the plugin object's members through the $this keyword. To call a plugin method you could do the following:


$ret = false;
$obj =& plugin_load('action', 'example'); // plugin type, plugin name
if ($obj!==NULL) { $ret = $obj->method_name($arg1, $arg2); }


Or you can trigger your own event - which the action plugin will have already registered for. e.g.

$data = array($arg1, $arg2, ... );
trigger_event("MYPLUGIN_MYDATA_MYACTION", $data, fnAction, bCanPreventDefault);


(the last two parameters are optional)

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

Other related posts: