Copied to clipboard

Flag this post as spam?

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


  • Gary Bronson 137 posts 46 karma points
    Oct 06, 2009 @ 21:44
    Gary Bronson
    0

    Getting name of a node from ParentID in an HTML template

    Stupid question:

     

    How do I get the name of a node from ParentID in an HTML template?

     

    Using v4

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Oct 07, 2009 @ 09:57
    Dirk De Grave
    1

    Gary,

     

    You can get the name of parent node using the inline xslt syntax 

    <umbraco:Item runat="server" field="parentID" xslt="umbraco.library:GetXmlNodeById({0})/@nodeName" />

    (Code is untested, so may need a tweak)

    Cheers,

    /Dirk

  • Gary Bronson 137 posts 46 karma points
    Oct 07, 2009 @ 15:14
    Gary Bronson
    0

    Dirk,

    I need to put this in a plain HTML template in Umbraco. I did that and it doesn't display anything.

  • Gary Bronson 137 posts 46 karma points
    Oct 07, 2009 @ 15:35
    Gary Bronson
    0

    Dirk,

    I need to put this in a plain ole HTML template in Umbraco. I did that and it doesn't display anything. No errors either.

    <span><umbraco:Item runat="server" field="parentID" xslt="umbraco.library:GetXmlNodeById({1052})/@nodeName" /> </span>

    None of the runat = "server" syntax works in my templates. Is there something I need to add to my pages to use this?

    Thanks,

    GaryB

  • Masood Afzal 176 posts 522 karma points
    Oct 07, 2009 @ 17:47
    Masood Afzal
    0

    Dirk solution is correct. Please note {0} instead of {1052}

    <umbraco:Item ID="Item1" runat="server" field="parentID" xslt="umbraco.library:GetXmlNodeById({0})/@nodeName" ></umbraco:Item> 

Please Sign in or register to post replies

Write your reply to:

Draft