Copied to clipboard

Flag this post as spam?

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


  • raghavendran 30 posts 50 karma points
    Jul 28, 2010 @ 13:36
    raghavendran
    0

    Root Id ??

    Im using umbraco 4.5 and i want to know the root id so that i may use GetXmlnodebyId to retrieve all the pages which are directly below it...Please help on this ?? :(

  • Matt Brailsford 4125 posts 22223 karma points MVP 9x c-trib
    Jul 28, 2010 @ 13:41
    Matt Brailsford
    0

    Hi,

    If you just want to "know" it, you can hover over a node in the admin area, and you'll see it's ID displayed in the status bar.

    If you want to find it programaticaly, you could use hendys helper method which you can find here:

    http://blog.hendyracher.co.uk/umbraco-helper-class/

    Many thanks

    Matt

  • raghavendran 30 posts 50 karma points
    Jul 28, 2010 @ 13:47
    raghavendran
    0

    the root id (of Content Folder) is acually not shown when we hover near it..it will only show for all it subpages...so i wanna know it so i may use it in my xslt...but i dont wanna use any other helper classes..

  • raghavendran 30 posts 50 karma points
    Jul 28, 2010 @ 13:50
    raghavendran
    0

    the root id (of Content Folder) is acually not shown when we hover near it..it will only show for all it subpages...so i wanna know it so i may use it in my xslt...but i dont wanna use any other helper classes..

  • Matt Brailsford 4125 posts 22223 karma points MVP 9x c-trib
    Jul 28, 2010 @ 13:51
    Matt Brailsford
    0

    The "Content" node, isn't actualy a node hence why it has no ID. You could try -1 though.

    Can I ask what you are trying to do so that I might be able to help find an alternative.

    Matt

  • raghavendran 30 posts 50 karma points
    Jul 28, 2010 @ 13:54
    raghavendran
    0

    I have some direct pages below it which i m needing it for showing as a set of links through xslt....So i need the root id so that i may get all its child nodes....

  • Matt Brailsford 4125 posts 22223 karma points MVP 9x c-trib
    Jul 28, 2010 @ 13:57
    Matt Brailsford
    0

    Hi,

    You could try getting them by level instead? Eveything at the root will be level 1. You could combine this with a specific doctypealias aswell to be a bit more specific?

    Matt

  • raghavendran 30 posts 50 karma points
    Jul 28, 2010 @ 14:03
    raghavendran
    0

     <xsl:for-each select="umbraco.library:GetXmlNodeById(1267)/../*">
          <xsl:if test="contains(internalTags,'TECHNOLOGY') and $currentPage/@id != @id">        
            <a href="{umbraco.library:NiceUrl(@id)}">
              <xsl:value-of select="*[name()=concat('technologyNicename',$flang)]"/>
            </a>
             <br/>

          </xsl:if>
        </xsl:for-each>

     

     

    this is my code... so node 1267 is a level 1 node....but i wanna get all level 1 nodes without harcoding the node id in xslt....so the better thing would be using my root id which wont change anytime....so i want it... i have tried root id but its not working in getxmlnodeby id......u got any ideas regarding this matt??

  • Matt Brailsford 4125 posts 22223 karma points MVP 9x c-trib
    Jul 28, 2010 @ 14:06
    Matt Brailsford
    0

    How about

    <xsl:for-each select="//*[@level=1 and @IsDoc]">
          <xsl:if test="contains(internalTags,'TECHNOLOGY') and $currentPage/@id != @id">        
            <a href="{umbraco.library:NiceUrl(@id)}">
              <xsl:value-of select="*[name()=concat('technologyNicename',$flang)]"/>
            </a>
             <br/> 
          </xsl:if>
    </xsl:for-each>

    Matt

  • raghavendran 30 posts 50 karma points
    Jul 28, 2010 @ 14:13
    raghavendran
    0

    No its not working matt :(

  • Matt Brailsford 4125 posts 22223 karma points MVP 9x c-trib
    Jul 28, 2010 @ 14:29
    Matt Brailsford
    0

    Give this a try for your for-each

    <xsl:for-each select="$currentPage/ancestor-or-self::root/*[@IsDoc]">

    Matt

  • Jeff Grine 149 posts 189 karma points
    Jul 28, 2010 @ 15:31
    Jeff Grine
    0

    umbraco.library:GetXmlAll() should work for you as well.

  • raghavendran 30 posts 50 karma points
    Jul 29, 2010 @ 06:31
    raghavendran
    0

    Both Didnt Work ppl...:(.

  • Matt Brailsford 4125 posts 22223 karma points MVP 9x c-trib
    Jul 29, 2010 @ 09:25
    Matt Brailsford
    0

    Hey,

    I would probably suggest that you try simplifying your XSLT and working your way up, as the last example I posted, I tried in a new install and it does work, so you may have an issue elswhere. Try removing your inner if statement for now, and just have the for-each loop. If this works, keep adding back more untill you find the point at which it breaks, then you know what you need to fix.

    Matt

  • Chriztian Steinmeier 2800 posts 8790 karma points MVP 8x admin c-trib
    Jul 29, 2010 @ 10:28
    Chriztian Steinmeier
    1

    Hi raghavendran,

    You get to the root node with ancestor-or-self::root:

    <xsl:variable name="contentRoot" select="$currentPage/ancestor-or-self::root" />

    The level 1 node are right below that, so:

    <xsl:for-each select="$contentRoot/*[@isDoc]">

    will get them for you.

    (Matt's earlier example was OK but he accidentally capitalized the isDoc attribute to IsDoc, which is why it didn't work).  

    /Chriztian

  • raghavendran 30 posts 50 karma points
    Jul 29, 2010 @ 11:13
    raghavendran
    0

    thanks Chriztian,

    It works perfectly now....U rock :)

    regards,

    Raghav

  • Matt Brailsford 4125 posts 22223 karma points MVP 9x c-trib
    Jul 29, 2010 @ 11:26
    Matt Brailsford
    0

    Dang it. I knew I was close =)

    Cheers Chriztian, I'll be sure to commit that to memory =)

    Matt

Please Sign in or register to post replies

Write your reply to:

Draft