[dokuwiki] Re: passing functions

  • From: Andreas Gohr <andi@xxxxxxxxxxxxxx>
  • To: dokuwiki@xxxxxxxxxxxxx
  • Date: Fri, 28 Apr 2006 20:52:54 +0200

On Wed, 26 Apr 2006 20:17:48 -0500
"Martin Tschofen" <martin.tschofen@xxxxxxxxx> wrote:

> This is more of a php question.
> In the search function we pass in the name of the function to call
> from within search. I want to pass a function that is local to the
> plugin I'm working on. Is it possible to pass in a reference to the
> search function that refers back to the plugin space? Or do I have to
> copy the search function into my plugin instead?

I just pushed a patch which changes the search function to accept an
array in $func. I haven't tested it my self yet - would be great if you
could. The following should work now:

class action_plugin_myindex extends Doku_Action_Plugin {

  function getInfo() { ... }
  function register() { ... }

  function mysearch(&$data, $base, $file, $type, $lvl, $opts) {
   ...
  }

  function hook() {

     search(..., array(&$this,'mysearch'), ... );
  }

}  // end class action plugin myindex

Andi

Other related posts: