Copied to clipboard

Flag this post as spam?

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


  • Andrew 2 posts 23 karma points
    Apr 03, 2011 @ 07:04
    Andrew
    0

    GetMedia usage

    Hi,

     

    How do I use the GetMedia method?

    This is identical to the code in one of the videos....

    <xsl:template match="/">
        <xsl:value-of select="atsFile"/>
          <xsl:value-of select="umbraco.library:GetMedia($currentPage/data [@alias = '@atsFile'], 'false')"/>
      </xsl:template>

     

    This code above throws an error: System.OverflowException: Value was either too large or too small for an Int32.

  • Andrew 2 posts 23 karma points
    Apr 03, 2011 @ 09:00
    Andrew
    1

    Here is the version that works:

     

    <xsl:template match="/">
        <xsl:variable name="dlFileId" select="/macro/fileId"/>
        <xsl:if test="$dlFileId">
          <xsl:value-of select="umbraco.library:GetMedia($dlFileId, 'false')/umbracoFile"/>
        </xsl:if>
      </xsl:template>

     

    In the video tutorial the syntax to access the attribute is data [@alias = 'umbracoFile'] so it seems that the tutorials just haven't been updated with the new changes.

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Apr 03, 2011 @ 11:13
    Jan Skovgaard
    1

    Hi Andrew

    Yeah the old vs new syntax issue is a bit confusing. Don't know if the videos will be updated but for future reference you could maybe have a look at the wiki entry explainig the usage of GetMedia - There's an example using the new schema as well: http://our.umbraco.org/wiki/reference/umbracolibrary/getmedia

    /Jan

  • czy 12 posts 32 karma points
    Jul 13, 2012 @ 10:51
    czy
    0

    There has been a change since Umbraco 4.5 for coding with GetMedia. It often makes developers confused.

    You could refer to our.umbraco.org/.../getmedia or Umbraco GetMedia-Complete Example.

     

Please Sign in or register to post replies

Write your reply to:

Draft