Search code examples
joomla

Get Module ID or Title


I' am using Joomla 3, I have module called "Who we Are" and it's being displayed on position "top_row2". I' am trying to get this modules ID and modules Name.

After Searching I found few solutions which doesn't seem to work for me.

Solution 1

jimport( 'joomla.application.module.helper' );
$module = JModuleHelper::getModule('Who we Are');
echo $module->id;

Solution 2

jimport( 'joomla.application.module.helper' );
$module = JModuleHelper::getModules('Who we Are');
echo $module->id;
//Note the "s" in getModules

Solution 3

    global $module;
    $module->id;
    $module->title;

I' am using this solutions on the override PHP files of this Module.

Location:: templates\corporate_response\html\mod_mymodule_item.php


Solution

  • You can define your own unique Class under "Module Class Suffix" and in your module override item page do a conditional to check which module is being rendered into the page