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.

1 Answer 1

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

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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