4
krc:
The propagation you mention shouldn't be really that hard, but in fact, module making implies taking care of two different propagations. Let me see if I can explain it right. Every module has in its table two variables: name and dirname; sometimes these variables have the same string; sometimes they don't (for instance, the News module has them equal, while the forum module has name = Forum and dirname = newbb).
For each module, you have access to these two variables through two lines in your xoops_version.php file:
$modversion['name'] = _MI_MD_NAME;
$modversion['dirname'] = _MI_MD_DIRNAME;
Of course, you can also write the names directly into xoops_version.php, but the recommended way is to use language constants so a user can change them at will.
In the modules admin page, each installed module is shown with a name under the icon. This name is extracted from the name field using:
$module->getVar('name', 'E')
So, basically, what's needed here is that, everywhere you want to display the module's name, instead of hard-coding it, you might use:
$module->getVar('name')
I learned this the hard way. While building Soapbox, I was asked to make it easy to clone. So I changed the name references. But instead of using the name, I was dumb enough to use dirname, which then I had to capitalize:
ucwords($module->getVar('dirname'))
or
ucwords($xoopsModule->dirname())
In fact, I still haven't finished correcting this stuff, but I wanted to share this here to maybe save a few minutes' time to other module builders.
So, the lesson is this: when building a module, create display references to the module by using
$module->getVar('name')
And, to make the module easy to clone, or easy to install in a directory different from the default one, create functional references to the modules directory by using
$module->getVar('dirname')
Maybe some code wizard could add a few points here (or correct me if I'm wrong), but this is really something that has to be taken into account if you want to build modules that users can easily adapt to their needs.
Cheers.