Copied to clipboard

Flag this post as spam?

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


  • Vincent Ashby-Smith 67 posts 196 karma points
    Jul 06, 2009 @ 14:29
    Vincent Ashby-Smith
    0

    Passing datasource id into macro id

    Hi all i'm quite new to Umbraco so please bare with me. I've taken and re-used some code (found on this forum, many thanks) to insert a flash file into a template. However what i would like to do is be able for the end users to be able to select the flash file they want using the nice user friendly front end. My macro takes in the following parameters:

    What i want to be able to do is to pass in instead of the video path of "1253" the path of the file that was selected using the media picker. I hope this is clear and hopefully someone could give me some direction!

    Many Thanks

    Vince

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Jul 06, 2009 @ 14:36
    Jan Skovgaard
    0

    When you get the ID from the media picker you should be able to get the file from that ID reference.

    Are you making the macro with a user control or an XSLT file?

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Jul 06, 2009 @ 14:37
    Dirk De Grave
    0

    Hi vince,

    Not possible OOB, as the mediaCurrent returns the id of the media item. But, as umbraco is quite flexible, it's possible to write your own macro rendering class that implements a specific interface IMacroGuiRendering that returns the media path instead of id. On the other hand, why do you need another gui for selecting a flash file from the media section? 

     

    Cheers,

  • Vincent Ashby-Smith 67 posts 196 karma points
    Jul 06, 2009 @ 15:26
    Vincent Ashby-Smith
    0

    Maco is an XSLT file. Basically i want the ability to be able to select the flash file through the nice user friendly section of the content section of umbraco. At the moment i can select the flash file but when inserting directly into a template. Below is my flash select macro:

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE xsl:Stylesheet [ <!ENTITY nbsp "&#x00A0;"> ]>
    <xsl:stylesheet
    version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:msxml="urn:schemas-microsoft-com:xslt"
    xmlns:umbraco.library="urn:umbraco.library"
    exclude-result-prefixes="msxml umbraco.library">


    <xsl:output method="html" omit-xml-declaration="yes"/>

    <xsl:param name="currentPage"/>
    <xsl:variable name="videonode" select="/macro/Video"/>
    <xsl:variable name="videopath" select="$videonode/node/data[@alias='umbracoFile']"/>
    <xsl:variable name="videoheight" select="/macro/VideoHeight"/>
    <xsl:variable name="videowidth" select="/macro/VideoWidth"/>

    <!-- ============================================================= -->

    <xsl:template match="/">
    <xsl:copy-of select="$currentPage"/>
    <div id="container"><a href="http://www.macromedia.com/go/getflashplayer">Get the Flash Player</a> to see this player.</div>
    <script type="text/javascript" src="/scripts/swfobject.js"></script>
    <script type="text/javascript">
    <![CDATA[
    // Previous JavaScript code
    var path = "]]><xsl:value-of select="$videopath" /><![CDATA[";
    var videowidth = "]]><xsl:value-of select="$videowidth" /><![CDATA[";
    var videoheight = "]]><xsl:value-of select="$videoheight" /><![CDATA[";
    // Rest of JavaScript code
    var s1 = new SWFObject(path,"SWF File",videowidth,videoheight,"9","#FFFFFF");
    s1.addParam("allowfullscreen","true");
    s1.addParam("allowscriptaccess","always");
    s1.addParam("wmode","transparent");
    s1.write("homeFlash");
    ]]>
    </script>


    </xsl:template>
    <!-- ============================================================= -->

    </xsl:stylesheet></span></span>

Please Sign in or register to post replies

Write your reply to:

Draft