I need to get id of current module in helper.php file of mod_menu. But there is no module parameters in this script.


I am not suer what exactly you are trying to do but the module Id is known to the module's main php file (mymodule.php)

So the only thing you have to do is pass to the helper's function as a param that value.


JLoader::register('ModMyModuleHelper', __DIR__ . '/helper.php');

ModMyModuleHelper::myHelpersFunction($module->id); // call the function in helper.

Then in your helper file in this function you will have the id


defined('_JEXEC') or die;

class ModMyModuleHelper

 public static function myFunction($moduleId) {
    echo $moduleId;

Hope this helps

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.