Copied to clipboard

Flag this post as spam?

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


  • Andreas Kristensen 20 posts 79 karma points
    Aug 19, 2011 @ 17:55
    Andreas Kristensen
    0

    List Childnodes differently by doctype

    Hello, 

    apologies for what is, im sure, a rather nooby question.
    ive tried to search for help but all documentation seems to be in a slightly different syntax than the one im using.

    I have two doctypes that i wish to display in a UL list: Article - Html and Article - PDF.
    html articles link to their url, 
    pdf articles link to their PDF file.

    I show the list via a macro on the relevant template as so:

    <umbraco:Macro  runat="server" language="cshtml">
    @inherits umbraco.MacroEngines.DynamicNodeContext

    @{ var numberOfItems = 10; }
    <ul>
    @foreach (var item in @Model.Children.Where("umbracoNaviHide != true").Where("nodeTypeAlias.value(tostring) == Artikelhtml").Take(numberOfItems).OrderBy("UpdateDate")) {
            <li><href="@item.Url">@item.Name</a></li>
        }
      </ul>
    </umbraco:Macro>

    this works except for the second where, wich is just my attempt at explaining what i want to do: limit this foreach to childnodes of the doctype artikelhtml.

    the most confusing thing to me is that all referances i can find use XSLT, but this dosent seem to.

    Can somebody clarify a bit please?


  • Lennart Stoop 304 posts 841 karma points
    Aug 19, 2011 @ 20:31
    Lennart Stoop
    0

    Hi Andreas, I believe this syntax should work:

    Where("nodeTypeAlias == \"Artikelhtml\"")
  • Andreas Kristensen 20 posts 79 karma points
    Aug 19, 2011 @ 22:11
    Andreas Kristensen
    0

    Thanks a lot Lennart, that solved my problem :)

  • 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