Copied to clipboard

Flag this post as spam?

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


  • Nicolai Sørensen 42 posts 66 karma points
    Oct 01, 2010 @ 10:46
    Nicolai Sørensen
    0

    mediaCurrent problem

    From being pretty new to umbraco I hope you guys can solve this before i tear my hair of ;)

    - I have created a MediaType called Flash and given the same properties as File

    - I have uploaded a Flash File which I have called through and macro using MediaPicker.

    - The variable is using MediaCurrent

     

    Problem:

    When I call the macro $fileId shows "/demo/media/103/top.swfswf533359" but $fileId/node/data[@alias = 'umbracoFile'] gives nothing.

    What am I missing? 

  • Kim Andersen 1447 posts 2196 karma points MVP
    Oct 01, 2010 @ 10:54
    Kim Andersen
    0

    Hi Nicolai

    Can you provide us with your XSLT-code that you use to render the content?

    I think you are pretty close.

    Try this approach:

    <xsl:value-of select="$fileId/data[@alias='umbracoFile']" />

    From what I can see, you have got the XML content of the media-item in the $fileId-variable, but I'm just guessing from the details you provided above :)

    /Kim A

  • Nicolai Sørensen 42 posts 66 karma points
    Oct 01, 2010 @ 11:07
    Nicolai Sørensen
    0
    <xsl:output method="xml" omit-xml-declaration="yes"/>
    <xsl:param name="currentPage"/>
    <xsl:template match="/">
    <xsl:variable name="fileId" select="/macro/FileId"/>
    <xsl:variable name="fileURL" select="/macro/FileURL"/>
    <xsl:variable name="fwidth" select="/macro/FWidth"/>
    <xsl:variable name="fheight" select="/macro/FHeight"/>
    <xsl:variable name="cssId" select="/macro/CssId"/>
    <xsl:variable name="urlParameters" select="/macro/UrlParameters"/>
    <xsl:if test="$fileId != '' or $fileURL != ''">
      <xsl:variable name="trueFileURL">
        <xsl:choose>
        <xsl:when test="$fileId != ''">
          <xsl:value-of select="$fileId/node/data[@alias = 'umbracoFile']"/>
        </xsl:when>
        <xsl:otherwise>
          <xsl:value-of select="$fileURL"/>
        </xsl:otherwise>
        </xsl:choose>
      </xsl:variable>

    Tried removing "node" but nothing happened

  • Kim Andersen 1447 posts 2196 karma points MVP
    Oct 01, 2010 @ 11:21
    Kim Andersen
    0

    Are you using the new or the old XML schema?

    And what does your $fileId contain? Only the choosen id from the media picker?

    If $fileId contais a media id you shopuld be able to get the path to the media this way if you are using the old schema:

    <xsl:value-of select="umbraco.library:GetMedia($fileId,0)/data[@alias='umbracoFile']" />

    And this way if you are using the new schema:

    <xsl:value-of select="umbraco.library:GetMedia($fileId,0)/umbracoFile" />

    /Kim A

  • Nicolai Sørensen 42 posts 66 karma points
    Oct 01, 2010 @ 11:31
    Nicolai Sørensen
    0

    I'm not sure what you mean, but this is the macro

    <umbraco:Macro FileId="1081" FileURL="" FWidth="960" FHeight="250" CssId="" UrlParameters="" Alias="InsertFlash" runat="server"></umbraco:Macro>

    In the macro FileId then becomes "demo/media/103/top.swfswf533359", guessing from mediaCurrent processing it.

    I have tried both your examples and on the mainpage it writes "error in the macro file"

  • Matthias 87 posts 173 karma points
    Oct 12, 2010 @ 15:43
    Matthias
    0

    Hi,

    i don't know if you already solved it. I had the same problem.
    If you use the old schema (and i guess you do) you have to insert a "*" to get the correct result:

    <xsl:value-of select="umbraco.library:GetMedia($fileId,0)/*/data[@alias='umbracoFile']" />

     

  • Nicolai Sørensen 42 posts 66 karma points
    Oct 12, 2010 @ 15:48
    Nicolai Sørensen
    0

    Ty so much Matthias.

     

    Just tested it and the did the trick.

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies