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
    Jul 31, 2014 @ 16:49
    Michael Jensen
    0

    List Child pages from Ancestor Macro

    Hey i have this macro that works great. but i like til to list all child pages of its ancestor and nor from a changeable source.

     

    i use it on this page til lis all item in a category. 

    http://hoejdata.dk/produkter/laptop/asus/asus-133/asus-zenbook-ux302.aspx ;

    I hope som can help me.

    @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())
        {
            <ul>
                @foreach (var page in startNode.Children.Where("Visible"))
                { 
                    <li class="SideSubPage"><a href="@page.Url">@page.Name</a></li>
                }
            </ul>
        }    
    }
  • 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.

Please Sign in or register to post replies