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.
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
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.
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.
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
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.
is working on a reply...