简体   繁体   中英

How to create a submenu in Joomla! frontend

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!

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM