Copied to clipboard

Flag this post as spam?

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


  • Laura Holland 82 posts 103 karma points
    Jan 07, 2011 @ 18:33
    Laura Holland
    0

    uComponents "Related Links w/Media" XSLT?

    While installing the uComponents package a screen comes up to select a variety of components for install.. I selected a few, but I got an error when trying to install. However, it appears that the core of uComponents installed successfully. I see that there are uComponent Datatypes available when I create a new datatype.

    So assuming that everything did install.. I created a datatype of Related Links with Media, added it to a Document Type, and created a Macro using the "Related Links" XSLT file template. I thought there would be a new XSLT template for the new "Related Links with Media" datatype, but I'm not seeing it. Am I missing something, or is it not included by default in this package?

    So anyway, it actually works fine except for the links to media files. They show up, but the link is just "#".

    Any ideas? Is there an XSLT file already written somewhere that works with the Related Links with Media datatype?

  • Lee Kelleher 4020 posts 15802 karma points MVP 13x admin c-trib
    Jan 07, 2011 @ 23:33
    Lee Kelleher
    1

    Hi Laura,

    Did you get any error messages with the installer? If so, let us know, we're looking for ways to improve it!

    As for the XSLT example, we don't currently supply any XSLT templates with uComponents.  We will look at doing this in future.

    Here's a modified version of the "RelatedLinks.xslt" that comes default with Umbraco - to use the media link:

    <ul>
        <xsl:for-each select="$currentPage/* [name() = $propertyAlias and not(@isDoc)]/links/link">
            <li>
                <xsl:element name="a">
                    <xsl:if test="./@newwindow = '1'">
                        <xsl:attribute name="target">_blank</xsl:attribute>
                    </xsl:if>
                    <xsl:choose>
                        <xsl:when test="./@type = 'external'">
                            <xsl:attribute name="href">
                                <xsl:value-of select="./@link"/>
                            </xsl:attribute>
                        </xsl:when>
                        <xsl:when test="./@type = 'media'">
                            <xsl:attribute name="href">
                                <xsl:value-of select="umbraco.library:GetMedia(./@link, 0)/umbracoFile" />
                            </xsl:attribute>
                        </xsl:when>
                        <xsl:otherwise>
                            <xsl:attribute name="href">
                                <xsl:value-of select="umbraco.library:NiceUrl(./@link)"/>
                            </xsl:attribute>
                        </xsl:otherwise>
                    </xsl:choose>
                    <xsl:value-of select="./@title"/>
                </xsl:element>
            </li>
        </xsl:for-each>
    </ul>

    Let us know how you get on with this.

    Cheers, Lee.

  • Laura Holland 82 posts 103 karma points
    Jan 10, 2011 @ 18:32
    Laura Holland
    0

    Thanks Lee! That code was just what I needed.

    FYI, I didn't exactly get an error when I installed uComponents. I timed out after the second installation screen, where there is a checkbox list of the various components. I selected a few, and when I hit submit, it timed out. But everything installed correctly, or so it appears. I was a little confused about the checkbox list of components - what did this do anyway?

  • Hendy Racher 863 posts 3849 karma points MVP 2x admin c-trib
    Jan 10, 2011 @ 19:21
    Hendy Racher
    0

    Hi Laura,

    I was confused with the checkbox list during the installation process too, as I was under the impression that if uComponents.Core.dll exists in the /bin folder then it's installed. (Other than an update to the web.config to hook in a HttpModule for the keyboard shortcuts).

    <add name="uComponentsModule" type="uComponents.Core.Modules.uComponentsModule, uComponents.Core"/>

    Cheers,

    Hendy

     

Please Sign in or register to post replies

Write your reply to:

Draft