Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Getting several load errors on a clean install on v4.7.2 - any thoughts?
and that would explain it! thanks Jorge! i will install 4.8 and give it a whirl!
Hello Jorge,
Thanks for the "fast" razor view (and the miniprofiler !! it's great)
Just for info, here is the way I would write the Navigation.cshtm. I use DynamicNode (not dynamic ;) and GetChildrenAsList.Items.Where(xxx)
In this case I don't have to get all children as an Array and do a filter afterwards.
Of course I use GetChildrenAsList if I only need the first level children, otherwise I use GetDescendant
PS : I didn't notice any performance improvement with my code throught...
@using umbraco.MacroEngines@inherits umbraco.MacroEngines.DynamicNodeContext@{ DynamicNode root = Model.AncestorOrSelf("Homepage"); <ul class="nav"> @{ var homeSelected = @Model.Level == 1 ? " class=\"active\"" : string.Empty; } <li@Html.Raw(homeSelected)><a href="@root.Url">@root.Name</a></li> @foreach (DynamicNode item in root.GetChildrenAsList.Items.Where(x => x.GetPropertyValue("UmbracoNaviHide") != "1")) { var selected = Array.IndexOf(Model.Path.Split(','), item.Id.ToString()) >= 0 ? " class=\"active\"" : string.Empty; List<DynamicNode> listChildren = item.GetChildrenAsList.Items.Where(x => x.NodeTypeAlias == "Textpage").ToList(); if (listChildren.Count() > 0) { <li class="dropdown"> <a href="@item.Url" class="dropdown-toggle" data-toggle="dropdown">@item.Name</a> <ul class="dropdown-menu"> @foreach (DynamicNode subItem in listChildren) { <li><a href="@subItem.Url">@subItem.Name</a></li> } </ul> </li> } else { <li@Html.Raw(selected)><a href="@item.Url">@item.Name</a></li> } } </ul>}
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.
Continue discussion
Error loading MacroEngine script
Getting several load errors on a clean install on v4.7.2 - any thoughts?
and that would explain it! thanks Jorge! i will install 4.8 and give it a whirl!
Hello Jorge,
Thanks for the "fast" razor view (and the miniprofiler !! it's great)
Just for info, here is the way I would write the Navigation.cshtm. I use DynamicNode (not dynamic ;) and GetChildrenAsList.Items.Where(xxx)
In this case I don't have to get all children as an Array and do a filter afterwards.
Of course I use GetChildrenAsList if I only need the first level children, otherwise I use GetDescendant
PS : I didn't notice any performance improvement with my code throught...
@using umbraco.MacroEngines
@inherits umbraco.MacroEngines.DynamicNodeContext
@{
DynamicNode root = Model.AncestorOrSelf("Homepage");
<ul class="nav">
@{ var homeSelected = @Model.Level == 1 ? " class=\"active\"" : string.Empty; }
<li@Html.Raw(homeSelected)><a href="@root.Url">@root.Name</a></li>
@foreach (DynamicNode item in root.GetChildrenAsList.Items.Where(x => x.GetPropertyValue("UmbracoNaviHide") != "1"))
{
var selected = Array.IndexOf(Model.Path.Split(','), item.Id.ToString()) >= 0 ? " class=\"active\"" : string.Empty;
List<DynamicNode> listChildren = item.GetChildrenAsList.Items.Where(x => x.NodeTypeAlias == "Textpage").ToList();
if (listChildren.Count() > 0)
{
<li class="dropdown">
<a href="@item.Url" class="dropdown-toggle" data-toggle="dropdown">@item.Name</a>
<ul class="dropdown-menu">
@foreach (DynamicNode subItem in listChildren)
{
<li><a href="@subItem.Url">@subItem.Name</a></li>
}
</ul>
</li>
}
else
{
<li@Html.Raw(selected)><a href="@item.Url">@item.Name</a></li>
}
}
</ul>
}
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.