1

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

3

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.

mymodule.php

<?php
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

helper.php

<?php
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, privacy policy and cookie policy

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