$menu->setActive() not setting all menus

125 views
Skip to first unread message

Dayo

unread,
Aug 20, 2012, 3:06:07 PM8/20/12
to joomla-de...@googlegroups.com
Hi all,


That is, by adding "$menu->setActive(XYZ)" to my component controller.php, I am able to get the Main Menu in the side bar to correctly be highlighted.

My issue is that when I try a theme from RocketTheme, I notice the are some other menus linked to main menu but that these are not highlighted.

I would have thought using the setActive would affect all menus but it seems not.

Can anyone kindly help nudge me in the right direction?

Thanks.

elin

unread,
Aug 20, 2012, 7:29:25 PM8/20/12
to joomla-de...@googlegroups.com
I believe that you are only allowed to have one active link on any rendered page according to W3C standards. Sometimes people use a work around to use another setting besides active and style it to appear active.

Elin

Dayo

unread,
Aug 21, 2012, 12:22:02 PM8/21/12
to joomla-de...@googlegroups.com
Thanks for that.

I am actually trying to make sure I have the same highlighted active link.

What is happening now is that some menus show the item I passed using "$menu->setActive(XYZ)" and other show the default "Home".

I want them to all show the same XYZ item.

Thanks again.

Dan YJ

unread,
Aug 22, 2012, 9:25:00 AM8/22/12
to joomla-de...@googlegroups.com
if ($menu->getActive() == $menu->getDefault()) {  //   $menu->getDefault( )  this is homepage 
build condition for homepage link only with snippet above


On Tuesday, 21 August 2012 21:17:52 UTC-4, Dan YJ wrote:
On Monday, August 20, 2012 3:06:07 PM UTC-4, Dayo wrote:
get it by current itemid
$menu = $app->getMenu();
if ($menu->getActive() == JRequest::getCmd('Itemid') == 155 ) {
        $active_link =' iam_active';
}
Reply all
Reply to author
Forward
0 new messages