Copied to clipboard

Flag this post as spam?

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


  • Michael Jensen 29 posts 98 karma points
    Aug 01, 2014 @ 18:11
    Michael Jensen
    0

    Macro that list all from ancestor

    Hey i have this macro that works great.

    but i like til to list all child pages of its ancestor and not from a changeable source.

    i am gona use it to liat all item in a category

    I hope som can help me.

    This is my macro

    @inherits umbraco.MacroEngines.DynamicNodeContext
    @*
        === Macro Parameters To Create ===
        Show:True   Alias:nodeId Name:Node ID    Type:Content Picker
    *@
    
    
    @{
        var startNodeID = Parameter.nodeId;
    }
    
    @if (startNodeID != null)
    {
        @* Get the start node as a dynamic node *@
        var startNode = Library.NodeById(startNodeID);
    
        if (startNode.Children.Where("Visible").Any())
        {
            
      @foreach (var page in startNode.Children.Where("Visible")) {
    • @page.Name
    • }
    } }
Please Sign in or register to post replies

Write your reply to:

Draft