I really hope someone can help me. Im trying to create a submenu.(i've used the snippet)
But i cannot seem to get the descentants in de sub list of the menu. Can someone please tell me how i can do that.
Thanks,
Jaco
@inherits Umbraco.Web.Macros.PartialViewMacroPage
@*
This snippet displays a list of links of the pages immediately under the top-most page in the content tree.
This is the home page for a standard website.
It also highlights the current active page/section in the navigation with the css class "current".
*@
@{ var selection = CurrentPage.Site().Children.Where("Visible"); }
@foreach (var item in selection)
{
if (item.Name == "Rondvaarten"){
Thank you very much Dennis.
I solved it a little bit different. but this helped a lot understanding it.
@inherits Umbraco.Web.Macros.PartialViewMacroPage
@*
This snippet displays a list of links of the pages immediately under the top-most page in the content tree.
This is the home page for a standard website.
It also highlights the current active page/section in the navigation with the css class "current".
*@
@{
var homePage = CurrentPage.AncestorsOrSelf(1).First();
var menuItems = homePage.Children.Where("UmbracoNaviHide == false");
}
Adding submenu in my navigation
I really hope someone can help me. Im trying to create a submenu.(i've used the snippet) But i cannot seem to get the descentants in de sub list of the menu. Can someone please tell me how i can do that.
Thanks, Jaco
@inherits Umbraco.Web.Macros.PartialViewMacroPage
@* This snippet displays a list of links of the pages immediately under the top-most page in the content tree. This is the home page for a standard website. It also highlights the current active page/section in the navigation with the css class "current". *@
@{ var selection = CurrentPage.Site().Children.Where("Visible"); }
@foreach (var item in selection) { if (item.Name == "Rondvaarten"){-
@item.Name
}
else {
-
@item.Name
}
}
Hi Jaco!
Look at this thread: https://our.umbraco.org/forum/using-umbraco-and-getting-started/77262-showing-parent-nodes-in-umbraco-snippet
Is'nt that kind of what you are looking for? A menu that Traverse the childrens children.
Best of luck, hope this helps!!
Thank you very much Dennis. I solved it a little bit different. but this helped a lot understanding it.
@* This snippet displays a list of links of the pages immediately under the top-most page in the content tree. This is the home page for a standard website. It also highlights the current active page/section in the navigation with the css class "current". *@
@{ var homePage = CurrentPage.AncestorsOrSelf(1).First(); var menuItems = homePage.Children.Where("UmbracoNaviHide == false"); }
@foreach (var item in menuItems) {-
@if (item.Name == "Rondvaarten")
{
@item.Name
}
else {
@item.Name
}
@{var subMenuItems = item.Children.Where("UmbracoNaviHide == false");}
@if (subMenuItems.Count() > 0)
{
}
@foreach (var sub in subMenuItems) {- @sub.Name
}
}Awesome Jaco, looks good, great job!!! Have a great weekend!!
is working on a reply...