Copied to clipboard

Flag this post as spam?

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


  • Fredrik Esseen 610 posts 906 karma points
    Sep 03, 2009 @ 20:11
    Fredrik Esseen
    0

    Listing videos from macro

    I use a modified version of BootNumlocks SimplePlayer to show flv-clips.

    As it is right now I pick the macro from the tinymce editor and displays the movie that way.

    But now i want to make a list of movies with some explaining text.

    This is the way that I do it now that doesnt work.

    I have a documenttype with two richtexteditors. in the first I include the macro, in the second I write some text.

    I have then created a macro that picks all nodes with that documenttype, a simple newslist u could say.

    But when I look at the page the macro with the movie is not rendered but looks like this:

    <?UMBRACO_MACRO videonodeid="1076" macroAlias="EndforwardUmbracoFLVPlayer" />
    the xslt looks like this:
    <?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="xml" omit-xml-declaration="yes"/>
    <xsl:param name="currentPage"/>
    <xsl:variable name="itemsToDisplay" select="5" />
    <xsl:template match="/">
    <div class="NewsPane">
    <div class="NewsHeader">
    <h2>Aktuellt</h2>
    </div>
    <div class="NewsListPane">
    <xsl:for-each select="$currentPage/descendant::node [@nodeTypeAlias = 'Nyheter']/node ">
    <xsl:sort select="@createDate" order="descending"/>
    <xsl:if test="@nodeTypeAlias='Nyhet'" >
    <xsl:if test="position() &lt;= $itemsToDisplay">
      <div class="NewsItem">
       <a href="{umbraco.library:NiceUrl(@id)}"><h3><xsl:value-of select="@nodeName" /></h3>
       <p><xsl:value-of select="data [@alias='ingress']/text()" disable-output-escaping="yes" /></p></a><br />
    <xsl:value-of select="data [@alias='bodyText']/text()" disable-output-escaping="yes" /><br />
    <xsl:value-of select="data [@alias='video']/text()" disable-output-escaping="yes" />
      </div>
    </xsl:if>
    </xsl:if></xsl:for-each>
    </div>
     <p><a href="/Nyheter.aspx">Fler händelser</a></p>
    </div>
    </xsl:template>
    </xsl:stylesheet>
    What is wrong? or how should I solve it otherwise?
  • Chris Koiak 700 posts 2626 karma points
    Sep 04, 2009 @ 12:22
    Chris Koiak
    1

    If the template is rendering

    <?UMBRACO_MACRO videonodeid="1076" macroAlias="EndforwardUmbracoFLVPlayer" />

    Then this usually implies the macro name is wrong, rather than an issue with your code.


  • Fredrik Esseen 610 posts 906 karma points
    Sep 04, 2009 @ 13:06
    Fredrik Esseen
    0

    What do you mean? That the macroAlias is not correct? Im picking the macro from inside the editor that shouldnt be the problem. I also tried to pcik another macro but that didnt work.

  • Fredrik Esseen 610 posts 906 karma points
    Sep 04, 2009 @ 14:50
    Fredrik Esseen
    0

    Im now very close to a solution:

    Instead of previous solution I now try to add the macro inside my list macro. I do this by creating a new property in the document type called "video" that is a media picker.

    So my code now looks like this:

    <xsl:value-of select="umbraco.library:RenderMacroContent('&lt;?UMBRACO_MACRO macroAlias=&quot;EndforwardUmbracoFLVPlayer&quot; videoNodeId=&quot;1234&quot; &gt; &lt;/?UMBRACO_MACRO&gt;', $currentPage/@id)" disable-output-escaping="yes"/>

    I now want to add the property video (which should be the nodeid?) instead of the numbers 1234 as you see in the code. How do the syntax look for that? Can I put a <xsl:value-of select="data [@alias='video']/text()" /> in there somehow?

  • Chris Koiak 700 posts 2626 karma points
    Sep 05, 2009 @ 08:16
    Chris Koiak
    0

    I've never used this approach before... but try

    <xsl:value-of select="umbraco.library:RenderMacroContent(concat('&lt;?UMBRACO_MACRO macroAlias=&quot;EndforwardUmbracoFLVPlayer&quot; videoNodeId=&quot;',1234,'&quot; &gt; &lt;/?UMBRACO_MACRO&gt;'), $currentPage/@id))" disable-output-escaping="yes"/>
  • Fredrik Esseen 610 posts 906 karma points
    Sep 05, 2009 @ 15:41
    Fredrik Esseen
    0

    Isnt that exactly the code I posted above?

    I solved it this way!

    <xsl:variable name="macro">
    <![CDATA[<?UMBRACO_MACRO macroAlias="EndforwardUmbracoFLVPlayer" videoNodeId="]]>
    <xsl:value-of select="data[@alias='video']"/>
    <![CDATA["></?UMBRACO_MACRO>]]>
    </xsl:variable>
    <xsl:value-of select="umbraco.library:RenderMacroContent($macro, $currentPage/@id)" disable-output-escaping="yes"/>

    Works perfect :)

  • Fredrik Esseen 610 posts 906 karma points
    Sep 05, 2009 @ 15:42
    Fredrik Esseen
    0

    Chris, sorry, didnt see yout concat :)

Please Sign in or register to post replies

Write your reply to:

Draft