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

1 Answer 1


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 agree to our terms of service and acknowledge you have read our privacy policy.

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