Copied to clipboard

Flag this post as spam?

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


  • Mads Sørensen 188 posts 433 karma points
    May 16, 2012 @ 12:20
    Mads Sørensen
    0

    Redirect to internal page with contentPicker

    Hey Guys

    i'm using 4.7.2

    I've three boxes on my home page, In each box there is a "Read more" link. But I cant figure out how to select a internal page with the Content Picker mediatype fx: www.mysite.com/newpage.aspx?

     

    <xsl:for-each select="$currentPage/FokusBoxe/FokusBox">
      <div class="fokusBox">

                
          <img src="{cropup:UrlByMediaId(fokusBillede, 'fokus')}" />
          
          <h1><xsl:value-of select="fokusOverskrift"/></h1>
          <h2><xsl:value-of select="fokusTekst"/></h2>
          
          <!-- fokusLink is the ContentPicker -->
          <a href="{umbraco.library:NiceUrl($currentPage/data[@alias='fokusLink'])}">Læs mere</a>
      
          
      
      </div>
    </xsl:for-each>

     

    Hope somone can help me :o)

    //mads

  • Chriztian Steinmeier 2726 posts 8320 karma points MVP 4x admin c-trib
    May 16, 2012 @ 12:36
    Chriztian Steinmeier
    0

    Hi Mads,

    The Content Picker stores the Id of the picked page, so you just throw that into the NiceUrl() extension - but I can see you've found some code for the old schema - here's how to make it work:

    <xsl:for-each select="$currentPage/FokusBoxe/FokusBox">
        <div class="fokusBox">
            <img src="{cropup:UrlByMediaId(fokusBillede, 'fokus')}" />
            <h1><xsl:value-of select="fokusOverskrift"/></h1>
            <h2><xsl:value-of select="fokusTekst"/></h2>
    
            <!-- fokusLink is the ContentPicker -->
            <xsl:if test="normalize-space(fokusLink)"> <a href="{umbraco.library:NiceUrl(fokusLink}">Læs mere</a> </xsl:if>
        </div>
    </xsl:for-each>

    /Chriztian

     

  • Mads Sørensen 188 posts 433 karma points
    May 16, 2012 @ 13:14
    Mads Sørensen
    0

    Hi Christian

    Thanks a lot :o)

    I was a bit confused cause I couldn't find any thing about this.

    I just have a little correction :o)

    <xsl:for-eachselect="$currentPage/FokusBoxe/FokusBox">
           
    <divclass="fokusBox">
                   
    <imgsrc="{cropup:UrlByMediaId(fokusBillede, 'fokus')}"/>
                   
    <h1><xsl:value-ofselect="fokusOverskrift"/></h1>
                   
    <h2><xsl:value-ofselect="fokusTekst"/></h2>

                   
    <!-- fokusLink is the ContentPicker -->
                   
    <xsl:iftest="normalize-space(fokusLink)"><ahref="{umbraco.library:NiceUrl(fokusLink)}">Læs mere</a></xsl:if>
           
    </div>
    </xsl:for-each>

    ...just missed a )


    :o)

  • 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