How to get module name in Joomla 2.5?

Inside my module (from inside php code), say mod_mymodule, how can I get the module name if the administrator changed it from the module control page?

Is it possible to get "status" and "position" just like a heading?

+6
source share
2 answers

Two useful variables are available inside the module: $module and $params .

You are looking for $module->title .

+11
source

Try the code below.

 <?php if ($module->showtitle) { echo '<h2>' .$module->title .'</h2>'; } ?> 

You can access the following functions.

 stdClass Object ( [id] => 18 [title] => Login Form [module] => mod_login [position] => left [content] => [showtitle] => 1 [control] => [params] => greeting=1 name=0 [user] => 0 [name] => login [style] => ) 

Joomla URL Link:
1.http : //docs.joomla.org/JModuleHelper/getModule
2. http://docs.joomla.org/Customising_the_way_modules_are_displayed

Updates - December 22, 2016

You can use jimport to get the module.

 jimport( 'joomla.application.module.helper' ); $module = JModuleHelper::getModule( 'login' ); // Single $module = JModuleHelper::getModule( 'mainmenu', 'Resources' ); // Multiple 
+8
source

Source: https://habr.com/ru/post/948124/


All Articles