Message Boards

Navigation Menu - Submenu problems

thumbnail
Pete Helgren, modified 4 Years ago.

Navigation Menu - Submenu problems

Regular Member Posts: 225 Join Date: 4/7/11 Recent Posts
I need to have at least a two level menu (three maybe) on the website I am developing.  I am not 100% clear on how menuing works in 7.2.  Here is what need:

A top level menu of sub menus and then those submenus will have submenus as well.  So I need multiples of this structure:
Top level item (defined as a submenu) .  Then additional ones at this level......
- Item 1 -Item 2-submenu (level 1)    --Submenu item 1    --Submenu item 2         --Submenu( level 2)And so on....
The Navigation Menus found under Site Builder looked like it would do what I wanted but I am getting results I don't quite understand.  I have a single page and then two submenus at the "top" level (leftmost position on the menu page).  Only the first submenu entry will display at the "top" level.  The second submenu doesn't display at all.  If I add a page at the "top" level, it will display but a second submenu will not.  The same phenomenon applies to a submenu that has a submenu.  That second submenu level doesn't display either.
Under pages,  there is also a page hierarchy that displays in a way that might work but I haven't figured how to set a "placeholder" through that interface that would allow me to have menus within menus.
Is there a way to accomplish the "nested" menu/submenu/submenu layout with the Navigation menu widget?
Kishan Agrawal, modified 4 Years ago.

RE: Navigation Menu - Submenu problems

New Member Posts: 24 Join Date: 1/8/18 Recent Posts
Hello,
Exectly not getting what you are looking for.But as per my understanding you are looking for 3 level navigation.
That can be achieved by costum ADT.
thumbnail
Pete Helgren, modified 4 Years ago.

RE: Navigation Menu - Submenu problems

Regular Member Posts: 225 Join Date: 4/7/11 Recent Posts
Kishan.  Thanks.  But I could use a little more complete answer.  Yes, I could have guessed an ADT could address the issue.  But what about "how"?  Maybe an example of how to go forward?  Maybe a suggestion about how the ADT is applied to the navigation menu?

I did find an example of a 4 level ADT here but like many answers on the forum,  it doesn't mention all of the details, like how to apply an ADT to an existing navigation  menu...
thumbnail
Mohammed Yasin, modified 4 Years ago.

RE: Navigation Menu - Submenu problems

Liferay Master Posts: 591 Join Date: 8/8/14 Recent Posts
Hi , May be below sample code helps you
<#if entries?has_content>
&nbsp; &nbsp; <ul>
&nbsp; &nbsp; &lt;#list entries as navItem&gt;&nbsp;
&nbsp; &nbsp; <li> &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; <a href="${navItem.getURL()}">${navItem.getName()}</a>
&nbsp; &nbsp; &nbsp; &nbsp;<ul>
&nbsp; &nbsp; &nbsp; &nbsp; &lt;#list navItem.getBrowsableChildren() &nbsp;as childNavItem&gt;&nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <li>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<a href="${childNavItem.getURL()}">${childNavItem.getName()}</a>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <ul>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;#list childNavItem.getBrowsableChildren() &nbsp;as subChildNavItem&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <li>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<a href="${subChildNavItem.getURL()}">${subChildNavItem.getName()}</a>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<!--#list-->
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</ul>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</li>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<!--#list-->&nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</ul>
&nbsp; &nbsp; &nbsp; &nbsp; </li>
&nbsp; &nbsp; <!--#list-->&nbsp;
&nbsp; &nbsp; </ul>
<!--#if-->
Kishan Agrawal, modified 4 Years ago.

RE: Navigation Menu - Submenu problems

New Member Posts: 24 Join Date: 1/8/18 Recent Posts
Hello Pete Helgren,
You are right 
Now what i would suggest is that liferay defult provide only head->child navigation for display 
I think what you are looking is head -> child -> child -> or N number.
if you want to get this thing done you will have to devlope some theme related class which will give you another box.
in which you can have you child pages also that will full fill your task. I have applied many time 3-N number of ADT for nvigation but for that you need help From UI Which will give you another box for lending your N level pages in the navigation.  
and if your question is how to apply ADT in the nvaigation you can easily get that  :- https://portal.liferay.dev/docs/7-1/user/-/knowledge_base/u/adt-example
thumbnail
Pete Helgren, modified 4 Years ago.

RE: Navigation Menu - Submenu problems

Regular Member Posts: 225 Join Date: 4/7/11 Recent Posts
Thanks to both of you.  Kishan, I am not sure what you mean by "you need help from UI which will give you a another box..."  What I can verify, using the sample that Mohammed  provided is that if you have a structure with like I showed above, which has a top level with an item and a submenu and then an item and a second submenu on that level with an item and a third submenu with an item, basically a three-level menu, ${entries?size} will only show 2 as the number of "navItems" in the list.  So maybe that is what you are saying Kishan?  Only the top levels are exposed in the list object by the theme?  By my reckoning if you have 7 items on three levels then ${entries?size} should  return 7, not 2.  If you add three top level items, like a menu item and two additional submenus at the top, then the ${entries.size}  shows 3.  So as far as I can see, <#list navItems as navItem>  is ONLY the top level list, the challenge is to get how many items the submenu has....