Copied to clipboard

Flag this post as spam?

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


  • Mark Olbert 87 posts 117 karma points
    Oct 31, 2009 @ 02:04
    Mark Olbert
    0

    Getting URL from NodeID in Template

    I'm embarrassed to admit I can't figure this one out: how do I get a URL from a nodeID in a template?

    I realize I can hard-code an href to a page path, but I'd like somethng that'll survive endusers changing the page name.

    - Mark

  • Masood Afzal 176 posts 522 karma points
    Oct 31, 2009 @ 02:24
    Masood Afzal
    0
    <%=  umbraco.library.NiceUrl(2020) %>

    replace 2020 with your node id
  • Josh Townson 67 posts 162 karma points
    Oct 31, 2009 @ 12:12
    Josh Townson
    0

    You can also get it in a template using:

    <a href="{localLink:2020}">Link Text</a>

    If you wanted to get the node name as the link text, then I would suggest making a small xslt to do it for you (plus you can then have a contentPicker so there is no chance of getting the node Id wrong)

  • Josh Townson 67 posts 162 karma points
    Oct 31, 2009 @ 12:13
    Josh Townson
    0

    hmm - the should have some curly braces in the href attribute surrounding localLink:2020

  • Josh Townson 67 posts 162 karma points
    Oct 31, 2009 @ 12:14
    Josh Townson
    0

    Apologies for multiple posts, this topic covers the same thing as you are trying to achieve: http://our.umbraco.org/forum/developers/xslt/5005-NiceURL-inline-xslt

     

  • 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