Enter Sourcerer from NoNumber (http://www.nonumber.nl/extensions/sourcerer). This plugin allows you to insert dynamic code into all areas of your site including content areas and even menu items. In this case, though, we want to use it to change the Title of your menu module depending on what menu item has just been clicked.
Here are the steps:
- Download the plugin using the URL above and make sure it is activated.
- Create your menu module in the normal way.
- In the title, instead of adding your normal static title, add this instead:
{source}
[[?php
$itemid = JRequest::getInt('Itemid',0);
$sql='SELECT name FROM #__menu WHERE id = '.$itemid;
$db=JFactory::getDBO(); $db->setQuery($sql);
echo $db->loadResult();
?]]
{/source} - Make sure when you copy and paste the code above that it copies all of it without line breaks. I just put it on different lines so you could see what it was doing.
- Save the module, and Sourcerer modifies the output of the Module Title and substitues the name of ther current menu item.
- If it works, and especially if this is a commercial website, buy a license code for the plugin. Its cheap and a small way of saying thank you for this cool plugin!
One downside is that the module Title in the Joomla admin interface is not very helpful, so it will be harder to identify your module, especially if you have more than one or two.