Copied to clipboard

Flag this post as spam?

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


  • Rich Green 2246 posts 4006 karma points
    Sep 13, 2009 @ 11:11
    Rich Green
    0

    List of a specific doctype from anywhere in site

    Hi,

    I need to get a list of 'Promo Boxes'  from where ever I am on the site.

    More specifically,  from any page I need to iterate through any docType "promoBox" which sits under the docType 'promoBoxesRight'

    Here's the structure:

    Home
    -About Us
    -Contact Us
    -Promo Boxes
        - Promo Boxes Right
            - Promo Box 1
            - Promo Box 2
        - Promo Boxes Center
            - Promo Box 3
            - Promo Box 4

    Pseudo code would read something like:

        //Home/nodeTypeAlias ="PromoBoxRight"/nodeTypeAlias ="promoBox"

    The 'Promo Boxes' docType has 'UmbracoNaviHide' set to true.

    Many thanks,

    Rich


  • Chris Koiak 700 posts 2626 karma points
    Sep 13, 2009 @ 12:23
    Chris Koiak
    0

    Try

    <xsl:for-each select="$currentPage/ancestor-or-self::node{@level=1]//node[@nodeTypeAlias='promoBoxRight']//node[@alias='promoBox']">
    // whatever
    </xsl:for-each>

    The syntax // means all child nodes. 'ancestor-or-self' allows you to search up the node structure.

    The above syntax ignores 'UmbracoNaviHide', so you'll need to add it in if you need it.

    Check out the subpages of http://our.umbraco.org/wiki/reference/xslt for more tips and examples.

    Cheers,

    Chris

  • Rich Green 2246 posts 4006 karma points
    Sep 13, 2009 @ 15:31
    Rich Green
    0

    Thanks Chris, that worked a treat.

    The only weird thing is that nothing would work until I deleted and recreated my document types.

    Thanks again.

  • 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