简体   繁体   中英

How to get module name of active menu on joomla 2.5?

I can get current menu title by this code :

<?php $active = JFactory::getApplication()->getMenu()->getActive(); echo $active->title; ?>

But can I somehow get the menu module name?

In the event you have multiple menus using 'mod_mainmenu' you could do something like this:

jimport( 'joomla.application.module.helper' );
$module = JModuleHelper::getModule( 'mainmenu', 'ModuleTitle' );
echo '<pre>';
print_r( $module );
echo '</pre>';

That will get you what you're looking for I think.

You can also check up on the JModuleHelper/getModule information in Joomla Docs - by studying that page you'll be able to do exactly what you want with little effort.

Cheers!

The following code use to put title in joomla

$document = JFactory::getDocument();

$document->setTitle('Page Title');

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM