Copied to clipboard

Flag this post as spam?

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


  • Kevon K. Hayes 255 posts 281 karma points
    Aug 21, 2010 @ 20:58
    Kevon K. Hayes
    0

    Returning the URL of the a Content Picker

    OK I git this semi-working...this is my node structure, beginning with the Menu Items node ignore DeptHome

    this is my XSLT:

    <xsl:template match="/">
    <ul class="menuItem">
     
    <xsl:for-each select="umbraco.library:GetXmlNodeById(1321)/corDeptMenuItem [@isDoc]">
               
       
    <li><a href="{umbraco.library:NiceUrl(@id)}"><xsl:value-of select="@nodeName"/></a></li>
               
     
    </xsl:for-each>
    </ul>
    </xsl:template>

    the only other thing I need to change is the URL.  It should grab the URL of the Item Link: Property which is a content picker. I would like the NiceURL of the Human Resources node selected in the content picker above and not the links of the Billing, Payments, and Purchasing nodes themselves.  Any direction appreciated.

  • Matt Brailsford 4125 posts 22223 karma points MVP 9x c-trib
    Aug 21, 2010 @ 21:42
    Matt Brailsford
    0

    Hi Kevon,

    Something like this should work

    <xsl:template match="/">
    <ul class="menuItem">
     
    <xsl:for-each select="umbraco.library:GetXmlNodeById(1321)/corDeptMenuItem [@isDoc]">
               
       
    <li><a href="{umbraco.library:NiceUrl(itemLink)}"><xsl:value-of select="@nodeName"/></a></li>
               
     
    </xsl:for-each>
    </ul>
    </xsl:template>

    When you retrieve the value from a content picker, it will be the id of the selected node, so you can simply pass it into the NiceUrl function, instead of the @id attribute (which is the id of the node containing the content picker).

    Matt

  • Matt Brailsford 4125 posts 22223 karma points MVP 9x c-trib
    Aug 21, 2010 @ 21:45
    Matt Brailsford
    0

    PS I've assumed your Item Link alias is "itemLink" so just change this to the relevant property alias if this is not the case

  • Kevon K. Hayes 255 posts 281 karma points
    Aug 21, 2010 @ 21:58
    Kevon K. Hayes
    0

    Thanks stepped away for a while and ill try this as soon as i get back to my workstation.

  • Kevon K. Hayes 255 posts 281 karma points
    Aug 22, 2010 @ 00:00
    Kevon K. Hayes
    0

    Great,

    Like Ambien it worked like a dream.  I learned a lot from you the last few days thanks.

  • Matt Brailsford 4125 posts 22223 karma points MVP 9x c-trib
    Aug 22, 2010 @ 12:19
    Matt Brailsford
    0

    Hey Kevon

    No problem. We've all been there, happy to be of assistance.

    Matt

  • srihari 4 posts 24 karma points
    Nov 27, 2012 @ 19:11
    srihari
    0

    Hi I tried the way it was mentioned here but it was a very old post and I cant get this working.

     

    Can anyone help me regarding this.

     

    The problem is I need  to link content picker Urls to images on the homepage

     

    Thanks 

    Ben

Please Sign in or register to post replies

Write your reply to:

Draft