Posts

Showing posts from November, 2014

Umbraco Razor Simple Alternative Subnav

@inherits umbraco.MacroEngines.DynamicNodeContext @{  var startLevel = String.IsNullOrEmpty(Parameter.Level) ? 2 : int.Parse(Parameter.StartLevel);  var finishLevel = String.IsNullOrEmpty(Parameter.Level) ? 8 : int.Parse(Parameter.FinishLevel);    var parent = Model.AncestorOrSelf(startLevel);  if (parent != null) { @traverse(parent,startLevel,finishLevel) ; } } @helper traverse(dynamic parent,int startLevel,int finishLevel) {  foreach (var node in parent.Children.Where("Visible")) {  var selected = Array.IndexOf(Model.Path.Split(','), node.Id.ToString()) >= 0 ? " id=\"current\"" : ""; <li >  <a href="@node.Url">@node.Name</a>                                       ...

Umbraco Razor Alternative method for Breadcrumbs

@inherits umbraco.MacroEngines.DynamicNodeContext <a href="@Model.AncestorOrSelf(2).Url">@Model.AncestorOrSelf(2).Name</a> @try{ @Html.Raw(" | " + @Model.AncestorOrSelf(3).Name) } catch{} @try{ @Html.Raw(" | " + @Model.AncestorOrSelf(4).Name) } catch{} @try{ @Html.Raw(" | " + @Model.AncestorOrSelf(5).Name) } catch{}