Copied to clipboard

Flag this post as spam?

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


  • Daniel Horn 319 posts 344 karma points
    Jan 13, 2011 @ 15:21
    Daniel Horn
    0

    Using The Multi-node Tree Picker

    Hi

    I'm trying to use The Multi-node tree picker as a sort of gallery picker.

    So on each page the user can select some pictures he/she wants to be displayed.

    But it won't display the pictures.

    I've just used the standard code from the ucomponents codeplex page:

    <xsl:template match="/">

      <!--
        uComponents: Multi-node Tree Picker - An XSLT example
        =====================================
        The Multi-node Tree Picker data-type will provide XML data based on the nodes you have selected.
        In this example, the property alias name for the Multi-node Tree Picker is "treePicker".
      -->

      <!-- First we check that the Multi-node Tree Picker has any nodeId values -->
      <xsl:if test="$currentPage/treePicker/MultiNodePicker/nodeId">

        <ul id="images">

          <!-- Loop through each of the nodeId values -->
          <xsl:for-each select="$currentPage/treePicker/MultiNodePicker/nodeId">

            <!-- Since we only have the nodeId value, we need to get the actual content node using umbraco.library's GetXmlNodeById method -->
            <!-- If you prefer to use pure XPath, then used this: "$currentPage/ancestor-or-self::*[@isDoc and @level = 1]/descendant-or-self::*[@isDoc and @id = current()]" -->
            <xsl:variable name="node" select="umbraco.library:GetXmlNodeById(.)" />

            <li>

              <!-- Output the URL using umbraco.library's NiceUrl method -->
              <href="{umbraco.library:NiceUrl(.)}">
                <img src="/css/imgs/billeder/thumbs/hovogn.jpg" width="104" height="76" alt="" />
              </a>

            </li>

          </xsl:for-each>

        </ul>

      </xsl:if>

    </xsl:template>

    What i want is this:

    <ul>

    <li><a href="billeder/hovogn.jpg"><img src="billeder/thumbs/hovogn.jpg" width="104" height="76" alt="" /></a></li>

    </ul>

  • Lee Kelleher 4020 posts 15802 karma points MVP 13x admin c-trib
    Jan 13, 2011 @ 15:27
    Lee Kelleher
    1

    Hi Daniel,

    The example XSLT is based on MNTP as a content picker, not media picker - so you'll just need to modify the following:

    <xsl:for-each select="$currentPage/treePicker/MultiNodePicker/nodeId">
        <xsl:variable name="media" select="umbraco.library:GetMedia(.)" />
        <li>
            <a href="{$media/umbracoFile}">
                <img src="/css/imgs/billeder/thumbs/hovogn.jpg" width="104" height="76" alt="" />
            </a>
        </li>
    </xsl:for-each>

    Not too sure how to get the image thumbnail?

    Cheers, Lee.

  • Jeroen Breuer 4908 posts 12265 karma points MVP 4x admin c-trib
    Jan 13, 2011 @ 15:40
    Jeroen Breuer
    1

    I'm working on a new media picker which can also select multiple items in 1 picker so it's perfect for a gallery. It also has an upload functionality. If you're interessted I can send you the RC.

    Jeroen 

  • Daniel Horn 319 posts 344 karma points
    Jan 13, 2011 @ 15:40
    Daniel Horn
    0

    Hi Lee,

    The thumbs should be the same, just with some imagegen magic.

    I'm able to save the xslt file with your changes, but on the page it just says error parsing blabla.. 

     

  • Lee Kelleher 4020 posts 15802 karma points MVP 13x admin c-trib
    Jan 13, 2011 @ 15:41
    Lee Kelleher
    1

    Hi Daniel,

    Yeah - my bad ... got the GetMedia syntax wrong!

    <xsl:variable name="media" select="umbraco.library:GetMedia(., false())" />

    Cheers, Lee.

  • Daniel Horn 319 posts 344 karma points
    Jan 13, 2011 @ 15:56
    Daniel Horn
    0

    Jeroen:

    I would very much like to have a look at that, is there any issues? Else i would like to use it on this production site actually :).

    mail me at : web @ dhbiz.dk 

    Lee:

    Cheers mate, will try it out :)

  • Daniel Horn 319 posts 344 karma points
    Jan 13, 2011 @ 15:59
    Daniel Horn
    0

    Lee:

    It's working now, just got to sort out the thumb thing now :)

    Thanks!

  • Daniel Horn 319 posts 344 karma points
    Jan 13, 2011 @ 16:36
    Daniel Horn
    0

    <xsl:attribute name="src">/umbraco/ImageGen.ashx?image=/{$media/umbracoFile}&amp;width=104</xsl:attribute>

    This was my best shot, got any other ideas guys? :)

  • Lee Kelleher 4020 posts 15802 karma points MVP 13x admin c-trib
    Jan 13, 2011 @ 16:38
    Lee Kelleher
    1

    Hi Daniel,

    You were very close!!! Move the img path to use inline XPath:

    <img src="/umbraco/ImageGen.ashx?image=/{$media/umbracoFile}&amp;width=104" width="104" height="76" alt="" />

    Cheers, Lee.

  • Daniel Horn 319 posts 344 karma points
    Jan 13, 2011 @ 16:41
    Daniel Horn
    0

    Thanks again Lee :)

  • Lee Kelleher 4020 posts 15802 karma points MVP 13x admin c-trib
    Jan 13, 2011 @ 16:43
    Lee Kelleher
    0

    You're welcome! :-D

Please Sign in or register to post replies

Write your reply to:

Draft