<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
thanks for jumping in :)<br>
<blockquote cite="mid200605042339.04495.larry@garfieldtech.com"
type="cite">
<pre wrap="">There's a bunch of ways to do plugins in PHP, some OO some not. In the CMS I
use at work, I think I have 2 or 3 different methods in use in various
places. :-)
If this is for Drupal specifically, then there's really just two ways to
reasonably consider:
1) Do you want other modules to be able to define these plugins? If so, then
the Drupal Way(tm) is to define a hook. You would call something like:
module_invoke_all('mymoduleapi', 'anoperation', $someparameter);
And other modules can simply declare a function:
function othermodule_mymoduleapi($op, $stuff) {
...
}
And do whatever. Hooking those together is handled magically by Drupal. See
hook_block(), hook_nodeapi(), etc. for examples.
</pre>
</blockquote>
perfect - that's what I need. I have a question about what if there
are multiple modules that are getting called back - but I'll look
through the doco and see what is what. I'll come back if I have any
questions<br>
<blockquote cite="mid200605042339.04495.larry@garfieldtech.com"
type="cite">
<pre wrap="">
2) Do you want people to just drop .inc files into a plugins directory inside
your module? For that, look at the flexinode module, which does exactly
that. (There are lots of others, but that's the first one that comes to
mind.) I've not looked at its guts in detail, but that's the direction you'd
want to go.
</pre>
</blockquote>
yeah - i started here - but I like the hook idea much better.<br>
<blockquote cite="mid200605042339.04495.larry@garfieldtech.com"
type="cite">
<pre wrap="">
As for what gets included, If you're module is enabled then Drupal will
automatically include your mymodule.module file on every page load, but
that's it. You can include/require whatever else you need/want. Note that
it is NOT included into the global namespace, so if you put stuff outside of
a function (which you shouldn't do), it won't be happening globally.
</pre>
</blockquote>
that's what I thought (that .module) are always included - thanks for
confirming.<br>
<blockquote cite="mid200605042339.04495.larry@garfieldtech.com"
type="cite">
<pre wrap="">
<a class="moz-txt-link-freetext" href="http://api.drupal.org/">http://api.drupal.org/</a> - Your new best friend. :-)
</pre>
</blockquote>
oh yeah - I'm all over it - just wasnt' sure the best place to begin -
thanks!<br>
<blockquote cite="mid200605042339.04495.larry@garfieldtech.com"
type="cite">
<pre wrap="">
</pre>
<blockquote type="cite">
<pre wrap="">Hi,
I want to introduce a concept of "plugins" to my module. In this case
the plugin merely needs to supply a single function that returns data.
Is the best way to do this to have the plugin call a register function
with the name of a function (and then call "eval"?). This is probably
more of a PHP question than a Drupal question. Oh yes and is there
documentation somewhere on what code Drupal automatically "includes"?
Thanks,
Dan
</pre>
</blockquote>
<pre wrap=""><!---->
</pre>
</blockquote>
<br>
</body>
</html>