Copied to clipboard

Flag this post as spam?

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


  • Charles 2 posts 22 karma points
    Dec 12, 2011 @ 14:22
    Charles
    0

    Load content based on page picker (Using Ultimate Picker)

    I have a series of boxes that contain information, that I want to be able to display on multiple pages.

    1. I have created a data type that uses the ultimate picker to choose pages based on ID. This works.
    2. Have referenced this in the Standard Document Type (
    chooseInfoBoxes is the Alias) and can select the items I want to show from the repository. All good so far.
    3. I need it to loop through the items in the repository, and if the info box has been ticked on the chooseInfoBoxes checkbox list. I thought i would simply need to test if the checkbox had been ticked, but I think i'm missing something. I'm fairly new to XSLT so any help pointing me in the right direction would be fantastic!

        <div id="infoBoxWrapper">
          <ul class="infoBox">
           <xsl:if test="chooseInfoBoxes='1' ">
            <xsl:for-each select="umbraco.library:GetXmlNodeById(1933)/homeInfoBoxItem [@isDoc]">
           <li class="infoBoxInner">
                <h1><xsl:value-of select="@nodeName"/></h1>
                <p><xsl:value-of select="infoBoxDescription"/></p>
            <xsl:if test="infoBoxLink != ''">
              <a href="{umbraco.library:NiceUrl(infoBoxLink)}">read more</a>
            </xsl:if>
            <img class="floatRight margin10" src="{infoBoxImage}" alt="{@nodeName}" width="150" height="150" align="right" />
          </li>
           </xsl:for-each>
            </xsl:if>
        </ul>
        </div>

  • Charles 2 posts 22 karma points
    Dec 12, 2011 @ 18:11
    Charles
    0

    I've managed to tweak something I found here:

    http://blog.leekelleher.com/2009/09/08/umbraco-ultimate-picker-xslt-example/

    This is my finished XSLT, hope it helps anyone with a similar problem.

      <xsl:template match="/">

        <xsl:variable name="preNodes">
              <xsl:variable name="infoBox" select="$currentPage/chooseInfoBoxes" />
              <xsl:variable name="nodeIds" select="umbraco.library:Split($infoBox, ',')" />
              <xsl:for-each select="$nodeIds/value">
                <xsl:copy-of select="umbraco.library:GetXmlNodeById(.)"/>
              </xsl:for-each>
        </xsl:variable>
        <xsl:variable name="nodes" select="msxml:node-set($preNodes)/*[@isDoc]" />
     <xsl:if test="count($nodes) > 0">  
    <div class="related-content">
    <h2>Related Content</h2>
    <ul class="infoBox">
              <xsl:for-each select="$nodes">
      <li class="infoBoxInner">
                <h1><xsl:value-of select="@nodeName"/></h1>
                <p><xsl:value-of select="infoBoxDescription"/></p>
            <xsl:if test="infoBoxLink != ''">
              <href="{umbraco.library:NiceUrl(infoBoxLink)}">read more</a>
            </xsl:if>
            <img class="floatRight margin10" src="{infoBoxImage}" alt="{@nodeName}" width="150" height="150" align="right" />
          </li>
                
    </xsl:for-each></ul>
    </div>
      </xsl:if>

      </xsl:template>

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies