Forums de discussion
3rd level navigation
lou cat, modifié il y a 11 années.
3rd level navigation
Regular Member Publications: 196 Date d'inscription: 26/01/12 Publications récentes
Hi!
I am getting crazy trying to implement a 3rd level navigation in my velocity side navigation template.
It should work like this:
- root
-- child
-- child
-- child
-- child_with_children
---grandchild
---grandchild
---grandchild
-- child
Usually the root is marked as "selected" if any of its children is selected, but with the 3rd level this doesn't happen, so if a grandchild is selected, root results selected but its parent (child_with_children) is not.
Why? In this other thread (http://www.liferay.com/community/forums/-/message_boards/message/8018380) they talk about bugs... is there a solution to implement this?
I'd like to have the whole grandchild menu (so the 3 grandchildren) visibile only if their parent (child_with_children) is selected, or if any of the grandchildren is selected.
Do you have any suggestion?
Thanks!!!
I am getting crazy trying to implement a 3rd level navigation in my velocity side navigation template.
It should work like this:
- root
-- child
-- child
-- child
-- child_with_children
---grandchild
---grandchild
---grandchild
-- child
Usually the root is marked as "selected" if any of its children is selected, but with the 3rd level this doesn't happen, so if a grandchild is selected, root results selected but its parent (child_with_children) is not.
Why? In this other thread (http://www.liferay.com/community/forums/-/message_boards/message/8018380) they talk about bugs... is there a solution to implement this?
I'd like to have the whole grandchild menu (so the 3 grandchildren) visibile only if their parent (child_with_children) is selected, or if any of the grandchildren is selected.
Do you have any suggestion?
Thanks!!!
Amit Doshi, modifié il y a 11 années.
RE: 3rd level navigation
Liferay Master Publications: 550 Date d'inscription: 29/12/10 Publications récentes
Please check below link :-
http://www.liferay.com/community/forums/-/message_boards/view_message/5679151
Regards,
Amit Doshi
http://www.liferay.com/community/forums/-/message_boards/view_message/5679151
Regards,
Amit Doshi
lou cat, modifié il y a 11 années.
RE: 3rd level navigation
Regular Member Publications: 196 Date d'inscription: 26/01/12 Publications récentes
Hi Amit,
Thanks but you linked the same thread I was mentioning... I can't see any solution in that one, am I missing something?
Thanks but you linked the same thread I was mentioning... I can't see any solution in that one, am I missing something?
jaid shaik, modifié il y a 11 années.
RE: 3rd level navigation
Regular Member Publications: 171 Date d'inscription: 08/10/10 Publications récentes
Hi lou,
Check the configuration right side of navigation portlet,
Display style:custom
Root layout level: 0 or 1 or 2 check depend on your child page menu..
The above configuration is worked for me at 3rd level of navigation portlet.
Check the configuration right side of navigation portlet,
Display style:custom
Root layout level: 0 or 1 or 2 check depend on your child page menu..
The above configuration is worked for me at 3rd level of navigation portlet.
lou cat, modifié il y a 11 années.
RE: 3rd level navigation
Regular Member Publications: 196 Date d'inscription: 26/01/12 Publications récentes
I'm not using a navigation portlet, I need my own implementation so I'm editing a velocity template...
lou cat, modifié il y a 11 années.
RE: 3rd level navigation
Regular Member Publications: 196 Date d'inscription: 26/01/12 Publications récentes
Ok at least it's possible... I now got a super messy code full of flags and loops, but it works.
I just feel (and I've seen I'm not the only one) this behaviour is a bit strange and I was wondering if it's going to remain like this also in 6.1 and following versions...
I would prefer getting a "selected" status for the parent page of a selected child (whatever level is considered), or at least having an intermediate status.
I just feel (and I've seen I'm not the only one) this behaviour is a bit strange and I was wondering if it's going to remain like this also in 6.1 and following versions...
I would prefer getting a "selected" status for the parent page of a selected child (whatever level is considered), or at least having an intermediate status.
lutz Bremen, modifié il y a 11 années.
RE: 3rd level navigation
Expert Publications: 291 Date d'inscription: 20/10/11 Publications récentes
could ushre ur code?
lou cat, modifié il y a 11 années.
RE: 3rd level navigation
Regular Member Publications: 196 Date d'inscription: 26/01/12 Publications récentes
Well, I'm afraid it's really messy, and it's more complicated than before, but here it is.
Probably not all the flags are needed and there is a simpler way to code this.
It is a side navigation menu with some checks on the page names as I needed short names in the breadcrumb but not in the side menu, I tried to cut that part not to confuse you, don't worry about that.
Probably not all the flags are needed and there is a simpler way to code this.
It is a side navigation menu with some checks on the page names as I needed short names in the breadcrumb but not in the side menu, I tried to cut that part not to confuse you, don't worry about that.
Pièces jointes:
lutz Bremen, modifié il y a 11 années.
RE: 3rd level navigation
Expert Publications: 291 Date d'inscription: 20/10/11 Publications récentes
ok this doesnt help ^^ but i solved it with the help of another code.^^
Rupesh Chotai, modifié il y a 11 années.
RE: 3rd level navigation
Regular Member Publications: 163 Date d'inscription: 23/03/11 Publications récentes
Hi Bremen,
Can you please share your solution, we also have similar kind of requirement?
Thanks in advance.
Can you please share your solution, we also have similar kind of requirement?
Thanks in advance.
Bradley Wood, modifié il y a 11 années.
RE: 3rd level navigation
Ryan Schuhler, modifié il y a 11 années.
RE: 3rd level navigation
Junior Member Publications: 77 Date d'inscription: 06/07/12 Publications récentes
A simple solution to this is to use .isChildSelected() to set the child_with_children to selected when the grandchild is selected. Attached on line 35 is when I have used it.
Pièces jointes:
Jennifer Carr, modifié il y a 11 années.
RE: 3rd level navigation
New Member Publications: 6 Date d'inscription: 26/07/12 Publications récentesRyan Schuhler:
A simple solution to this is to use .isChildSelected() to set the child_with_children to selected when the grandchild is selected. Attached on line 35 is when I have used it.
This is great and exactly what I was looking for too!
I was wondering how you would modify it so that only the selected items showed their children while the others with children didn't?
Actually I am looking for that as well as going down 4 levels deep instead of 3.
Thanks, Jenn
Ryan Schuhler, modifié il y a 11 années.
RE: 3rd level navigation
Junior Member Publications: 77 Date d'inscription: 06/07/12 Publications récentes
Yes, both of those are possible, for the 4th level just repeat the logic of the above levels. You can add a $nav_item.isSelected to the if statement with $hasChildren to display only the children of selected pages. I attached a changed file. Hopefully it helps, test it out.
Pièces jointes:
Jennifer Carr, modifié il y a 10 années.
RE: 3rd level navigation
New Member Publications: 6 Date d'inscription: 26/07/12 Publications récentesRyan Schuhler:
Yes, both of those are possible, for the 4th level just repeat the logic of the above levels. You can add a $nav_item.isSelected to the if statement with $hasChildren to display only the children of selected pages. I attached a changed file. Hopefully it helps, test it out.
Ryan,
This has helped us a lot so first I want to say thank you!
I was wondering what you'd recommend to modify this to display just the ancestors and the children relative to the page? Sort of like breadcrumbs but with the addition of the page's children (grand children not necessary).
Ryan Schuhler, modifié il y a 10 années.
RE: 3rd level navigation
Junior Member Publications: 77 Date d'inscription: 06/07/12 Publications récentes
All you need to do is wrap all of the content inside your loop to check if the nav_item is selected, this will make it only print out the given pages ancestors, it would look something like:
Hope it helps!
#foreach ($nav_item in $nav_items)
#if ($nav_item.isSelected())
//print out nav_item and children
#end
#end
Hope it helps!
gordon daniels, modifié il y a 11 années.
RE: 3rd level navigation
Liferay Master Publications: 797 Date d'inscription: 24/08/08 Publications récentes
Jennifer: I know you are using Ryan's solution. I have used his in the past as well. But you might want to check Bradley Wood's latest blog. He has included code for doing 3rd level nav. Both navigation.vm and custom.css.