Copied to clipboard

Flag this post as spam?

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


  • Bas Schouten 135 posts 233 karma points
    Feb 18, 2010 @ 16:49
    Bas Schouten
    0

    Count Items From Media

    I want to use a variable name instead of the "1043". Is that possible?

    <xsl:value-of select="count(umbraco.library:GetMedia(1043,1)/node)"/>

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Feb 18, 2010 @ 16:55
    Dirk De Grave
    0

    Hi Bas,

    Sure that's possible, use 

    <xsl:variable name="mediaId" select="/macro/mediaId" />
    <xsl:value-of select="count(umbraco.library:GetMedia($mediaId,1)/node)"/>

    in this case, mediaId variable is fetched from the macro properties settings tab.

    (May run into xslt error when saving, but that can be resolved by adding an if statement that checks whether $mediaId != '')

     

    Hope this helps.

    Regards,

    /Dirk

     

  • Bas Schouten 135 posts 233 karma points
    Feb 18, 2010 @ 17:00
    Bas Schouten
    0

    Hi Dirk,

    Super! The extra IF fixed the problem.

    <xsl:if test="$ImageFolder != ''">
    <xsl:value-of select="count(umbraco.library:GetMedia($ImageFolder,1)/node)"/>
    </xsl:if>

    Regards,

    Bas

     

Please Sign in or register to post replies

Write your reply to:

Draft