2022/11/28 7:57:41
|
---|
|
get module foldernameI'm updating iForum to be compatible with the upcoming ImpressCMS 1.5.0, and as such I need to replace the $icmsModule variable with something else. That variable is used in many cases in this way :
When I replace it with icms::$module->getvar('dirname') the value I get back is always 'system' instead of the folder in which the iforum module resides. Any idea how I can retrieve the module folder in newer code? |
_________________
|
2022/12/3 10:45:17
|
---|
|
Re: get module foldernameI would think that should work - I have it working like that for SimplyWiki. I have also set the module directory in the header file, which then is used to set icms::$module Other IPF modules use some logic to determine if they are in the module
This puts the directory name in a constant, which is set dynamically as the module loads {module}/include/common.php If you're in the module's preferences, you will be in the system module, technically, for most modules. Edited by skenow on 2022/12/3 11:19:22
|
_________________
Steve Twitter: @skenow Facebook: Steve Kenow |
2022/12/6 4:53:56
|
---|
|
Re: get module foldernameI'll need to check out how this works in that case for iForum. It's rather old code and my first focus is to get it working on 1.5.0 without rewriting it completely. The way you describe @skenow is not always possible, I remember from the old X days that it was sometimes possible to clone modules, and this the module needed to be aware of the folder in which it was installed. That wasn't hardcoded in a constant. Not that I think that's a good way of doing things, but I'm just saying perhaps some of that logic is also there for iForum. |
_________________
|
2022/12/10 9:49:18
|
---|
|
Re: get module foldernameThe constant wasn't hardcoded - it was determined as the module was loading - modules/{module directory}/icms_version.php or something early in the loading sequence. With imBlogging, the constant is defined in {imblogging directory}/include/common.php. In icms_version.php -
In include/common.php -
|
_________________
Steve Twitter: @skenow Facebook: Steve Kenow |