Foren
3rd level navigation
lou cat, geändert vor 11 Jahren.
3rd level navigation
Regular Member Beiträge: 196 Beitrittsdatum: 26.01.12 Neueste Beiträge
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, geändert vor 11 Jahren.
RE: 3rd level navigation
Liferay Master Beiträge: 550 Beitrittsdatum: 29.12.10 Neueste Beiträge
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, geändert vor 11 Jahren.
RE: 3rd level navigation
Regular Member Beiträge: 196 Beitrittsdatum: 26.01.12 Neueste Beiträge
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, geändert vor 11 Jahren.
RE: 3rd level navigation
Regular Member Beiträge: 171 Beitrittsdatum: 08.10.10 Neueste Beiträge
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, geändert vor 11 Jahren.
RE: 3rd level navigation
Regular Member Beiträge: 196 Beitrittsdatum: 26.01.12 Neueste Beiträge
I'm not using a navigation portlet, I need my own implementation so I'm editing a velocity template...
lou cat, geändert vor 11 Jahren.
RE: 3rd level navigation
Regular Member Beiträge: 196 Beitrittsdatum: 26.01.12 Neueste Beiträge
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, geändert vor 11 Jahren.
RE: 3rd level navigation
Expert Beiträge: 291 Beitrittsdatum: 20.10.11 Neueste Beiträge
could ushre ur code?
lou cat, geändert vor 11 Jahren.
RE: 3rd level navigation
Regular Member Beiträge: 196 Beitrittsdatum: 26.01.12 Neueste Beiträge
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.
Anhänge:
lutz Bremen, geändert vor 11 Jahren.
RE: 3rd level navigation
Expert Beiträge: 291 Beitrittsdatum: 20.10.11 Neueste Beiträge
ok this doesnt help ^^ but i solved it with the help of another code.^^
Rupesh Chotai, geändert vor 11 Jahren.
RE: 3rd level navigation
Regular Member Beiträge: 163 Beitrittsdatum: 23.03.11 Neueste Beiträge
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, geändert vor 11 Jahren.
RE: 3rd level navigation
Ryan Schuhler, geändert vor 11 Jahren.
RE: 3rd level navigation
Junior Member Beiträge: 77 Beitrittsdatum: 06.07.12 Neueste Beiträge
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.
Anhänge:
Jennifer Carr, geändert vor 10 Jahren.
RE: 3rd level navigation
New Member Beiträge: 6 Beitrittsdatum: 26.07.12 Neueste BeiträgeRyan 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, geändert vor 10 Jahren.
RE: 3rd level navigation
Junior Member Beiträge: 77 Beitrittsdatum: 06.07.12 Neueste Beiträge
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.
Anhänge:
Jennifer Carr, geändert vor 10 Jahren.
RE: 3rd level navigation
New Member Beiträge: 6 Beitrittsdatum: 26.07.12 Neueste BeiträgeRyan 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, geändert vor 10 Jahren.
RE: 3rd level navigation
Junior Member Beiträge: 77 Beitrittsdatum: 06.07.12 Neueste Beiträge
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, geändert vor 10 Jahren.
RE: 3rd level navigation
Liferay Master Beiträge: 797 Beitrittsdatum: 24.08.08 Neueste Beiträge
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.