Copied to clipboard

Flag this post as spam?

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


  • Niels Kristiansen 166 posts 382 karma points
    Mar 26, 2010 @ 13:08
    Niels Kristiansen
    0

    How to get a link in the media

    Hi,

    I used this awesome package for a new website, but I have som difficulties setting up a link.

    In the mediatype I placed the following:

    Name: Link to page
    Alias: slideshowLink
    Type: Content Picker
    Tab: Content

    When I choose to create a new media, I choose my new Mediatype "Slideshow", upload a picture and set a link.

    Everything works fine except the link. Either I get a error or nothing appears when I try to place the information in XSLT.

    Here is the XSLT document:

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp "&#x00A0;">]>
    <xsl:stylesheet
    version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:msxml="urn:schemas-microsoft-com:xslt"
    xmlns:umbraco.library="urn:umbraco.library" xmlns:Exslt.ExsltCommon="urn:Exslt.ExsltCommon" xmlns:Exslt.ExsltDatesAndTimes="urn:Exslt.ExsltDatesAndTimes" xmlns:Exslt.ExsltMath="urn:Exslt.ExsltMath" xmlns:Exslt.ExsltRegularExpressions="urn:Exslt.ExsltRegularExpressions" xmlns:Exslt.ExsltStrings="urn:Exslt.ExsltStrings" xmlns:Exslt.ExsltSets="urn:Exslt.ExsltSets"
    exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets ">


    <xsl:output method="xml" omit-xml-declaration="yes" />

    <xsl:param name="currentPage"/>

    <!-- Input the related links property alias here -->
    <xsl:variable name="propertyAlias" select="string('frontSlideshow')"/>

    <xsl:template match="/">

    <!-- The fun starts here -->
    <ul class="teaser">
    <xsl:for-each select="$currentPage/data [@alias = $propertyAlias]/links/link">
    <li>
    <div class="copy">
    <h1><xsl:value-of select="umbraco.library:GetMedia(./@link,0)/data[@alias='slideshowHeader']"/><br /><span class="thin"><xsl:value-of select="umbraco.library:GetMedia(./@link,0)/data[@alias='slideshowSubHeader']"/></span></h1>
    <p><xsl:value-of select="umbraco.library:GetMedia(./@link,0)/data[@alias='slideshowCopy']"/></p>
    <p><a href="WHAT CODE SHOULD BE INSERTED TO GET THE CONTENT PICKER LINK">THE PROBLEM IS RIGHT HERE!</a></p>
    </div>
    <span class="img_bg">
    <xsl:element name="img">
    <xsl:attribute name="src">
    <xsl:value-of select="umbraco.library:GetMedia(./@link,0)/data[@alias='umbracoFile']"/>
    </xsl:attribute>
    <xsl:attribute name="alt">
    <xsl:value-of select="umbraco.library:GetMedia(./@link,0)/data[@alias='slideshowHeader']"/>
    </xsl:attribute>
    </xsl:element>
    </span>
    <span class="fade_red"></span>
    </li>
    </xsl:for-each>
    </ul>
    <!-- Live Editing support for related links. -->
    <xsl:value-of select="umbraco.library:Item($currentPage/@id,$propertyAlias,'')" />

    </xsl:template>

    </xsl:stylesheet>

    Is there anyone who could tell me that magic code I need, to get a link working through a mediatype?

     

    Kind regards,

    Niels Kristiansen

  • Nik Wahlberg 639 posts 1237 karma points MVP
    Mar 26, 2010 @ 14:47
    Nik Wahlberg
    0

    Hi there, you should be using the following:

    <xsl:value-of select="umbraco.library:NiceUrl(./@link)"/>

    or 

    <a href="{umbraco.library:NiceUrl(./@link)}">link</a>

     

    I think this should do it...

    HTH,
    Nik

  • Niels Kristiansen 166 posts 382 karma points
    Mar 26, 2010 @ 21:38
    Niels Kristiansen
    0

    Hi Nik,

    Thanks for the reply, but it don't work. I need to call

    data[@alias='slideshowLink']

    in the same line, because this is the one who got the Content Picker with the link information.

    If I call the @link only, nothing will appear, and I will return the number on the media link instead of the alias slideshowLink (does it make any sense?)

     

    Kind regards,

    Niels

  • Jan Skovgaard 11280 posts 23678 karma points MVP 10x admin c-trib
    Mar 27, 2010 @ 00:20
    Jan Skovgaard
    0

    Hi Niels

    In that case I think that you will ned to write

    <a href="{umbraco.library:NiceUrl(data [@alias='slideshowLink'])}">My link</a>

    Does this help?

    /Jan

  • Niels Kristiansen 166 posts 382 karma points
    Mar 27, 2010 @ 11:10
    Niels Kristiansen
    0

    Hi Jan,

    Unfortunately it didn't work. But in the meantime I found the solution :)

    Here it is:

    <a href="{umbraco.library:NiceUrl(umbraco.library:GetMedia(./@link,0)/data[@alias='slideshowLink'])}">Read more</a>

    Thanks for the time and replies, both from you and Nik.

     

    Kind regards,

    Niels

Please Sign in or register to post replies

Write your reply to:

Draft