Copied to clipboard

Flag this post as spam?

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


  • Chris Knowles 141 posts 222 karma points
    Dec 14, 2010 @ 16:03
    Chris Knowles
    0

    Uploaded Image

    Hi,

    I have scoured the forum but can't find the answer i need.

    I have an upload control on a page to upload an image for a product. I cannot figure out how to get the path to the thumbnail to show on my products listing page. I have tried all examples on here and none work.

      <xsl:template match="/">
      <!-- The fun starts here -->
      <xsl:for-each select="$currentPage/* [@isDoc and string(umbracoNaviHide) != '1']">
        <xsl:if test="position() mod 3 = 1">
          <div class="left">
            <a href="{umbraco.library:NiceUrl(@id)}">
              <xsl:if test="count(./* [@isDoc]) &gt; 0">
                <img src="{concat(substring-before(./*/productImage,'.'), '_thumb.jpg')}" style="border: none;"/>
              </xsl:if>
              <xsl:value-of select="@nodeName"/>
            </a>     
          </div>
        </xsl:if>
        <xsl:if test="position() mod 3 = 2">
          <div class="middle">
            <a href="{umbraco.library:NiceUrl(@id)}">
              <img src="{@productImage}" alt="{data [@alias = 'photoText']}" />
              <xsl:value-of select="@nodeName"/>
            </a>     
          </div>
        </xsl:if>
        <xsl:if test="position() mod 3 = 0">
          <div class="right">
            <a href="{umbraco.library:NiceUrl(@id)}">
              <img src="{@productImage}" alt="{data [@alias = 'photoText']}" />
              <xsl:value-of select="@nodeName"/>
            </a>
          </div>
        </xsl:if>
      </xsl:for-each>
      </xsl:template>


    Please can someone tell me what i'm doing wrong!

    Thanks

    Chris

  • Rich Green 2246 posts 4008 karma points
    Dec 14, 2010 @ 16:07
    Rich Green
    1

    What version of Umbraco are you running?

  • Chris Knowles 141 posts 222 karma points
    Dec 14, 2010 @ 16:08
    Chris Knowles
    0

    Sorry, school boy error there.

    it's 4.5.2 on iis6

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Dec 18, 2010 @ 18:46
    Jan Skovgaard
    0

    Hi Chris

    The sample posted is based on the old XML schema used in older Umbraco versions. With 4.5 there is a new schema.

    The above sample seems to be a mix of the new and old schema.

    For an example this part does not make sense with the new schema
    <img src="{@productImage}" alt="{data [@alias = 'photoText']}" />

    in the alt attribute the old data [@alias = photoText] is used. And the @productImage does not make sense since I don't think the productImage is an attribute in the XML output?

    I'm guessing that the above line of code should look like this instead

    <img src="{productImage}" alt="{photoText}" />

    I can imagine that this is the XML elements containing the values that you need.

    Maybe you should try to make a xsl:copy-of to see what XML you get returned. It makes it much more easy to work with and find out what you need to match.

    You can do it by making a textarea like this

    <textarea>
    <xsl:copy-of select="$currentPage/* [@isDoc and string(umbracoNaviHide) != '1']" />
    </textarea>

    Hope this makes a little sense and that it helps a bit.

    /Jan

Please Sign in or register to post replies

Write your reply to:

Draft