What I'm trying to do is create a submenu (in Joomla! backend) with below code but it does not work.

JSubMenuHelper::addEntry(JText::_('test'), 'index.php?option=com_test&controller=test', $controller == 'testcon');

I have attacted a sample pictures here. It explains what type of menu I want.

sample menu is here. check this picture

Thanks!

有帮助吗?

解决方案

JSubMenuHelper is designed to be used in the Joomla! Administrator section, it's not made for the frontend.

If you really want to get to it, you need to include the file:

/administrator/includes/toolbar.php

Also you will have a bunch of missing CSS (js maybe also) files that you also need to include (form the admin template folder)

But I see no reasons what you want to use JSubMenuHelper in front-end. I would strongly advise against using it.

其他提示

You should create menu and (submenu) in Admin Panel, but I think you already know that :) Later you add look and feel with CSS. I think you should do ti with CSS not PHP.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top