Phatjew, thanks for your note. (I didn't even keep track on the posting-count..)
Mvandam, your alternative approach were definately more intuitive. Perhaps thats the way to go? Can you benchmark your approach to mine?
However, as I promised in an erlier post, I've made a more consistant approach, which voids all of the problems described in erlier posts:
Use the following code in top of all the files where it's needed:
le="color: #000000"><?php // Get path to this file. $pathparts = explode("/", realpath(__FILE__)); // Then extract the module name from the path: $ModuleName = $pathparts[array_search('modules', $pathparts)+1]; // Prepare a prefix for the language constants. $VarPrefix = '_MI_'.strtoupper($ModuleName);
Note: _MI_ should be replaced by the appropriate string.
_MI_ = ModuleInfo. Used in xoops_version.php
_AM_ = AdMin. Used in all admin files.
_MD_ = Modules. Used in... eahh.. Modules.
etc...
The use it like this in xoops_version.php:
le="color: #000000"><?php $modversion['dirname'] = $ModuleName; $modversion['name'] = constant($VarPrefix.'_NAME'); $modversion['description'] = constant($VarPrefix.'_DESC');
And like this in the language files:
le="color: #000000"><?php define($VarPrefix.'_NAME','Skeleton'); define($VarPrefix.'_DESC','Simple module.');
And like this in the blocks and admin (and smarty, to keep consistancy!):
le="color: #000000"><?php $xoopsTpl->assign('greeting', constant($VarPrefix.'_GREETING')); $uname = constant($VarPrefix.'_ANONYMOUS');
And finally to sum it all up, these variables are very handy in blocks, admin etc. too:
le="color: #000000"><?php $ModuleUrlPath = XOOPS_URL."/modules/".$ModuleName; $ModuleRootPath = XOOPS_ROOT_PATH."/modules/".$ModuleName;
I've not been able to spot any problems, yet... But thats what you are here for!

Best regards,
Daigoro