Molod
Molod

Reputation: 352

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?

Upvotes: 1

Views: 2394

Answers (2)

Ankush Srivastava
Ankush Srivastava

Reputation: 502

The following code use to put title in joomla

$document = JFactory::getDocument();

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

Upvotes: 1

Hanny
Hanny

Reputation: 2159

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!

Upvotes: 2

Related Questions