Copied to clipboard

Flag this post as spam?

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


  • Johan 188 posts 380 karma points
    Sep 03, 2010 @ 17:49
    Johan
    0

    iterating unpublished nodes

    I'm making a widget that lists the latest news. I'm doing something like this.

    <xsl:variable name="newsNodeSet" select="umbraco.library:GetXmlAll()//node[@nodeTypeAlias = 'newsItem']" />

    And iterate through the nodes. Problem is that i get all the unpublished nodes to. But the properties are empty. So my widget lists "ghost news". I could check if the "header property" of the newsItem node is empty but that is not very cosher. There must be a better way to do it. Why do umbraco.config list unpublished nodes in the first place? Is it a bug?

  • Chriztian Steinmeier 2800 posts 8790 karma points MVP 8x admin c-trib
    Sep 03, 2010 @ 18:59
    Chriztian Steinmeier
    1

    Hi Johan,

    I've never used GetXmlAll() - mostly because to me it makes no sense to put what I assume must be another copy of the entire tree (which is already in memory) into the memory.

    This will only get you published content:

    <xsl:variable name="newsNodeSet" select="$currentPage/ancestor-or-self::root//node[@nodeTypeAlias = 'newsItem']" />

    /Chriztian

  • Johan 188 posts 380 karma points
    Sep 06, 2010 @ 10:20
    Johan
    0

    @Christian Thanks, i will use that method instead of getXmlAll.

    This doesn't solve my problem though. The node shouldn't be in umbraco.config in the first place. I think it has something to do with the autofolder package which I'm using. When i create a new "newsItem" the news item gets partially published. It looks unpublished but the newsItem node somehow get into umbraco.config but without any property data.

Please Sign in or register to post replies

Write your reply to:

Draft