[dokuwiki] Re: passing functions

  • From: Chris Smith <chris@xxxxxxxxxxxxx>
  • To: dokuwiki@xxxxxxxxxxxxx
  • Date: Thu, 27 Apr 2006 03:13:13 +0100

Martin Tschofen 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?

Thanks...martin
The way search is structured you would have to define the function outside of the plugin class, but it could still be defined within the same file and used as a paramter for search.

e.g.

class action_plugin_myindex extends Doku_Action_Plugin {

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

 function hook() {
    search(..., 'mysearch', ... );
 }

}  // end class action plugin myindex

function mysearch(&$data, $base, $file, $type, $lvl, $opts) {
  ...
}
--
DokuWiki mailing list - more info at
http://wiki.splitbrain.org/wiki:mailinglist

Other related posts: