i have a website that runs with the igloo package.
But i have an issue of how to get the composition information in the navigation
i am trying to make a true / false for whether or not to show it as a link to the page. Because some menu parts won't actually need a page behind it.
i am getting the pages like the following:
var selection = site.Children().Where(x => x.IsVisible();
and then i foreach through the selection.
For each item in the selection i want to check if the setting withoutLink is available and true.
However i don't have any idea how i could get this information from the current item. This setting is created inside a compositions.
And the composition is applied to all the document types so that each page has this individual option.
Does anyone has any idea how i could read this information in that foreach statement?
I'm not quite sure I understand why a Menu item wouldn't have a link! - but would something like the following work for you?
@{
var selection = site.Children().Where(x => x.IsVisible());
}
<ul>
@foreach (var menuItem in selection) {
//check if menuItem's 'withoutLink' property is set
if (menuItem.HasProperty("withoutLink") &&
menuItem.GetPropertyValue<bool>("withoutLink")){
// then menuItem doesn't have a link...
<li>@menuItem.Name</li>
}
else {
//menuItem has a link...!
<li><a href="@menuItem.Url">@menuItem.Name</a></li>
}
}
</ul>
Getting composition information in navigation
Hello,
i have a website that runs with the igloo package. But i have an issue of how to get the composition information in the navigation
i am trying to make a true / false for whether or not to show it as a link to the page. Because some menu parts won't actually need a page behind it.
i am getting the pages like the following: var selection = site.Children().Where(x => x.IsVisible(); and then i foreach through the selection.
For each item in the selection i want to check if the setting withoutLink is available and true. However i don't have any idea how i could get this information from the current item. This setting is created inside a compositions. And the composition is applied to all the document types so that each page has this individual option.
Does anyone has any idea how i could read this information in that foreach statement?
i hope i am clear of what i am trying to do.
Hi Sprite
I'm not quite sure I understand why a Menu item wouldn't have a link! - but would something like the following work for you?
if I've understood correctly!
regards
marc
Hi Marc,
Thanks for answering my question. The menuItem.GetPropertyValue
I will mark your answer as correct.
is working on a reply...