Copied to clipboard

Flag this post as spam?

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


  • dfarrow 16 posts 27 karma points
    Mar 18, 2010 @ 14:55
    dfarrow
    0

    How do I use <umbraco:item> to get the "id" of a content node (or other node level attributes)?

    I am trying to get the "id" of a node in a Master Page template.  I was thinking I could use:

    <umbraco:Item runat="server"  field="id" />

    How do I get these node level attributes for use on a Master Page without using a macro?

     

  • Peter Dijksterhuis 1442 posts 1722 karma points
    Mar 18, 2010 @ 15:02
    Peter Dijksterhuis
    0

    Hi,

    if you edit the template from within umbraco, you can click the button on top (the one next to the save button) to insert a umbraco-field. In the popup, you can define which property you want to show. You'll note that some properties you are familiar with in xslt have a different naming in here. So, for the Id, you'd use:

    <umbraco:Item field="pageID" runat="server"></umbraco:Item>
    HTH,
    Peter

  • Douglas Robar 3570 posts 4711 karma points MVP ∞ admin c-trib
    Mar 18, 2010 @ 15:03
    Douglas Robar
    0

    When you click the 'insert field' button on the toolbar of the template editor you'll get a dropdown list of all the fields you can choose. Those with an @ symbol are 'builtin' items. You'll be able to get the pageName (aka, @nodeName in xslt), the id, level, etc.

    Shout if you have any problems.

    cheers,
    doug.

  • Douglas Robar 3570 posts 4711 karma points MVP ∞ admin c-trib
    Mar 18, 2010 @ 15:03
    Douglas Robar
    0

    Haha... Peter beat me by 40 seconds! What a great community, eh?

    d.

  • Peter Dijksterhuis 1442 posts 1722 karma points
    Mar 18, 2010 @ 15:08
    Peter Dijksterhuis
    0

    I finally made it :P

  • dfarrow 16 posts 27 karma points
    Mar 18, 2010 @ 16:10
    dfarrow
    0

    Awesome info, thanks guys.  I see how to get most properties, but I still can't seem to get "creatorName"...how would I get that attribute?

    Thanks

     

  • Peter Dijksterhuis 1442 posts 1722 karma points
    Mar 18, 2010 @ 16:18
    Peter Dijksterhuis
    0

    That would probably be @writerName (everything starting with a @ are default properties from umbraco)

    Peter

  • dfarrow 16 posts 27 karma points
    Mar 18, 2010 @ 17:23
    dfarrow
    0

    Wow, "writerName" actually does return the "creatorName" from the XML and not the actual "writerName", as one would expect.  How unintuitive.  However, I still love Umbraco!  Thanks guys.

  • dfarrow 16 posts 27 karma points
    Mar 19, 2010 @ 20:03
    dfarrow
    0

    Woops, no, I was wrong...writerName DOES return the "writerName" from the XML...Does anyone know how to get the "creatorName"?

Please Sign in or register to post replies

Write your reply to:

Draft