Copied to clipboard

Flag this post as spam?

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


  • Eric Warren 48 posts 68 karma points
    Jul 28, 2010 @ 15:49
    Eric Warren
    0

    List Pages by Node Alias Level

    So this is my dilemma.  This works for every other page on the site besides when i navigate to the pages that the for each list.

    <xsl:for-each select=" $currentPage/ancestor-or-self::node//node [@nodeTypeAlias ='Blog']/descendant::node[@level=5]/node[string(data[@alias='umbracoNaviHide']) != '1'] ">

     

  • Matt Brailsford 4124 posts 22215 karma points MVP 9x c-trib
    Jul 28, 2010 @ 16:06
    Matt Brailsford
    0

    Hi Eric,

    Are you trying to find a blog node within the current pages ancestory? Or just any page which is a blog?

    Try one of these:

    <xsl:for-each select=" $currentPage/ancestor-or-self::node [@nodeTypeAlias ='Blog']/descendant::node[@level=5]/node[string(data[@alias='umbracoNaviHide']) != '1'] ">
    <xsl:for-each select=" $currentPage/ancestor-or-self::root//node [@nodeTypeAlias ='Blog']/descendant::node[@level=5]/node[string(data[@alias='umbracoNaviHide']) != '1'] ">

    Matt

  • Lee Kelleher 4020 posts 15802 karma points MVP 13x admin c-trib
    Jul 28, 2010 @ 16:08
    Lee Kelleher
    0

    Hi Eric,

    Its a bit long-winded, but I don't know much about your content structure, try this:

    <xsl:for-each select=" $currentPage/ancestor-or-self::node[@level=1]/descendant::node[@nodeTypeAlias ='Blog']/descendant::node[@level=5]/node[string(data[@alias='umbracoNaviHide']) != '1']">

    A breakdown of this... From the current page, go all the way up to the root node (level 1), then down the nodes to the 'Blog' node type, then down to level 5 node - then list the child nodes that aren't hidden.

    The XPath could be condensed, but would need to know a little more about the content structure.

    Cheers, Lee.

  • Eric Warren 48 posts 68 karma points
    Jul 28, 2010 @ 16:18
    Eric Warren
    0

    Those got the same results as the code above.  Here is my content structure. I have the maco pulling the list in the master template. 

    So the code above will list the blog pages on Home and Pages 1 & 2 but will not list the blog pages on the Blog page nor any node below.

    Hope this helps.

    My content tree is like the following

    Home

       -Page 1

       -Page 2

       -Blog

           - Year

                -Month

                   - Day

                       - Blog Page

     

  • Matt Brailsford 4124 posts 22215 karma points MVP 9x c-trib
    Jul 28, 2010 @ 16:31
    Matt Brailsford
    0

    Would something like this work?

    <xsl:for-each select=" $currentPage/ancestor-or-self::root//node[@nodeTypeAlias ='Blog']//node[@nodeTypeAlias ='BlogPage' and string(data[@alias='umbracoNaviHide']) != '1']">

    Matt

  • Eric Warren 48 posts 68 karma points
    Jul 28, 2010 @ 18:04
    Eric Warren
    0

    Yea that didnt work either.  Wonder if i have to do a choose base on the location in the content tree.

  • Matt Brailsford 4124 posts 22215 karma points MVP 9x c-trib
    Jul 28, 2010 @ 18:55
    Matt Brailsford
    0

    It should be possible in one statement, as what you are doing is navigating to the root and then re-narrowing down.

    Did you update the alias' in my example (I don't know what your alias' are so just made a guess).

    What it should be doing is navigating to the root, then selecting any node of type "blog" and then any sub node of type "blogpost" that is set to display in the nav.

    If I understand correctly, you are basically wanting to create a list blogposts on the site?

    Matt

  • Eric Warren 48 posts 68 karma points
    Jul 28, 2010 @ 19:47
    Eric Warren
    0

    My bad It works,  I thought the logic was correct. The page wasn't refreshing.  Sometimes it the most simplest thing that get you.

    Thanks again for you help.

  • Matt Brailsford 4124 posts 22215 karma points MVP 9x c-trib
    Jul 28, 2010 @ 23:21
    Matt Brailsford
    0

    Hehe, glad you got it working.

    Matt

Please Sign in or register to post replies

Write your reply to:

Draft