Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Rocoeh 65 posts 86 karma points
    May 21, 2012 @ 14:34
    Rocoeh
    0

    Ordering sub nav

      I am using the following script to output my subnav. Is there a way to order the pages? A drag and drop would be nice.

     

     

      <umbraco:Macro runat="server" language="cshtml">
    @{
      var currentPage = Model;
      while (currentPage.Level>2) { currentPage=currentPage.Parent; }
      <ul class="subnav">
      @foreach (var c in currentPage.Children)
      {
       <li><a href="@c.Url">@c.Name</a></li>
       }
      </ul>  
    }
    </umbraco:Macro>

  • gilad 185 posts 425 karma points
    May 21, 2012 @ 14:40
    gilad
    0

    Hii Rocoeh.

    You can sort your page from content section - right click on your parent node and then - "sort".

    Another issue - you can replace this :
     var currentPage = Model;
      while (currentPage.Level>2) { currentPage=currentPage.Parent; }   

     with this:

    <ul class="subnav">
      @foreach (var c in  Model.AncestorOrSelf(1).Children)
      {
       <li><href="@c.Url">@c.Name</a></li>
       }
      </ul>  

  • Fuji Kusaka 2203 posts 4220 karma points
    May 21, 2012 @ 14:44
    Fuji Kusaka
    0

    Hi Rocoeh,

    You can sort your order like this

    @{
    var c = Model.AncestorOrSelf(1).Children.OrderBy("createDate descending");
    }

    //fuji

Please Sign in or register to post replies

Write your reply to:

Draft