Copied to clipboard

Flag this post as spam?

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


  • Matt 15 posts 45 karma points
    Oct 04, 2010 @ 22:24
    Matt
    0

    Has anyone gotten this to work in multiple environments?

    We're using a three tier environment -- devl, modl, prod.  I have gotten this picker to work well in a single environment, but when I publish content and media from one environment to another, the node id's no longer match up.  This causes my images to not come up as expected using the Tree Multi Picker.  This hasn't been an issue for us with the standard picker.  Here is the XSLT I'm using:

     

    <?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"
        xmlns:msxsl="urn:schemas-microsoft-com:xslt"
        xmlns:math="urn:schemas-hizi-nl:math"
        xmlns:Exslt.ExsltStrings="urn:Exslt.ExsltStrings"
        xmlns:Exslt.ExsltMath="urn:Exslt.ExsltMath"
        exclude-result-prefixes="msxml Exslt.ExsltMath Exslt.ExsltStrings math umbraco.library">


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

    <xsl:param name="currentPage"/>

    <msxml:script language="JavaScript" implements-prefix="math">
    function random(numDie,numMax,numMin){
    if (numMin==null){numMin=1;}
    var sum=0;
    for (var index=0;index&lt;numDie;index++){
    sum+=Math.floor(Math.random()*(numMax-numMin) + numMin);
    }
    return "" + sum;
    }
    function floorme(numFloor){
    return "" + Math.floor(numFloor);
    }
    </msxml:script>

    <xsl:template match="/">

    <xsl:variable name="images" select="$currentPage/data[@alias='rotatingImages']"/>
    <xsl:if test="$images != ''">
       <xsl:variable name="splitDocs" select="umbraco.library:Split($images, ',')" />
       <xsl:variable name="random" select="math:random(1, count($splitDocs/value)+1, 1)"/>
          <xsl:for-each select="$splitDocs/value">
          <xsl:if test="position()=$random">
             <xsl:if test=". != ''">
                <xsl:variable name="mediaNode" select="umbraco.library:GetMedia(.,0)"/>
                <xsl:if test="$mediaNode != ''">
                      <img src="{$mediaNode/data [@alias='umbracoFile']}" alt="{$mediaNode/@nodeName}"/>
               </xsl:if>
            </xsl:if>
          </xsl:if>
          </xsl:for-each>
    </xsl:if>

    </xsl:template>

    </xsl:stylesheet>

  • Matt 15 posts 45 karma points
    Oct 04, 2010 @ 22:26
    Matt
    0

    Forgot to place in code:


    <?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"
    xmlns:msxsl="urn:schemas-microsoft-com:xslt"
    xmlns:math="urn:schemas-hizi-nl:math"
    xmlns:Exslt.ExsltStrings="urn:Exslt.ExsltStrings"
    xmlns:Exslt.ExsltMath="urn:Exslt.ExsltMath"
    exclude-result-prefixes="msxml Exslt.ExsltMath Exslt.ExsltStrings math umbraco.library">


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

    <xsl:param name="currentPage"/>

    <msxml:script language="JavaScript" implements-prefix="math">
    function random(numDie,numMax,numMin){
    if (numMin==null){numMin=1;}
    var sum=0;
    for (var index=0;index&lt;numDie;index++){
    sum+=Math.floor(Math.random()*(numMax-numMin) + numMin);
    }
    return "" + sum;
    }
    function floorme(numFloor){
    return "" + Math.floor(numFloor);
    }
    </msxml:script>

    <xsl:template match="/">

    <xsl:variable name="images" select="$currentPage/data[@alias='rotatingImages']"/>
    <xsl:if test="$images != ''">
    <xsl:variable name="splitDocs" select="umbraco.library:Split($images, ',')" />
    <xsl:variable name="random" select="math:random(1, count($splitDocs/value)+1, 1)"/>
    <xsl:for-each select="$splitDocs/value">
    <xsl:if test="position()=$random">
    <xsl:if test=". != ''">
    <xsl:variable name="mediaNode" select="umbraco.library:GetMedia(.,0)"/>
    <xsl:if test="$mediaNode != ''">
    <img src="{$mediaNode/data [@alias='umbracoFile']}" alt="{$mediaNode/@nodeName}"/>
    </xsl:if>
    </xsl:if>
    </xsl:if>
    </xsl:for-each>
    </xsl:if>

    </xsl:template>

    </xsl:stylesheet>
  • Sebastiaan Janssen 5060 posts 15522 karma points MVP admin hq
    Oct 05, 2010 @ 08:27
    Sebastiaan Janssen
    0

    Did you reseed the database between environments?

    Of course there might be changes to config files that could cause this. Any difference in the web.config or umbracosettings.config other than the database connection string and debugging settings?

  • Matt 15 posts 45 karma points
    Oct 05, 2010 @ 16:14
    Matt
    0

    We didn't reseed -- using Courier to publish media files.

    No differences in config files other than connection strings.

  • Sebastiaan Janssen 5060 posts 15522 karma points MVP admin hq
    Oct 06, 2010 @ 20:28
    Sebastiaan Janssen
    0

    Well, it looks like courier is just changing the media Id's then.. You should probably have a talk with Courier support about this!

Please Sign in or register to post replies

Write your reply to:

Draft