感谢大家,我已经能够从Joomla 3中的活动父菜单项创建一个变量:$ mytitle。
这是我的代码:
$menu = JFactory::getApplication()->getMenu();
$parent = $menu->getItem( $menu->getActive()->parent_id );
$parentname = $parent->title;
$parentlink = JRoute::_( $parent->link . '&Itemid=' . $parent->id );
$menulevel = $menu->getActive()->level; $activename= $menu->getActive()->title;
$mytitle = ($menulevel == 1)?$activename:$parentname;
echo $mytitle;
这很好但现在我需要在我的子菜单项(VMenuBlock)上使用它。代码如下,我似乎无法弄清楚如何放置变量使其工作?
function modChrome_vmenu($module, &$params, &$attribs)
{
if (!empty ($module->content)) {
if (function_exists('VMenuBlock'))
echo VMenuBlock(($module->showtitle != 0) ? $module->title : '', $module->content,
$params->get('moduleclass_sfx'));
else
echo Block(($module->showtitle != 0) ? $module->title : '', $module->content,
$params->get('moduleclass_sfx'));
}
}
感谢任何帮助!, 谢谢! 道格