Copied to clipboard

Flag this post as spam?

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


  • RokkaD 2 posts 22 karma points
    Mar 21, 2013 @ 11:27
    RokkaD
    0

    help needed to display different images via Media Picker & Multi Node Tree Picker

    Hello,

    I'm fairly new to Umbraco (3 weeks in) and I'm having a bit of trouble with some Xslt. I've cobbled together the below code from searching around on the web and this forum and have it working how I'd like. *Displays 3 articles on a page which have been picked via the Multi Node Tree Picker Data Type - with a different image per article.*

    However, rather than using <img><xsl:attribute> to show the image for each article I'd like to use umbraco.library.GetMedia and use a 'Media Picker' data type rather than the 'Upload' data type when selecting the image in the 'Content' area. However, if I change the code to this the image selected for all 3 articles is the same (the first articles image).

    Any help on how I can do this would be massively appriciated.

    Below is the current xslt code and a massive thank you in advance.

    <xsl:template match="/">
     
    <!-- start writing XSLT -->
    <xsl:for-each select="$currentPage/ancestor-or-self::*/top3Articles/MultiNodePicker/nodeId">
    <xsl:variable name="idProject" select="."/>
     
    <xsl:for-each select="$currentPage/ancestor-or-self::* [@isDoc and @level= 1]//* [@isDoc and @level = 4]">
     
    <xsl:variable name="idNodePicker" select="@id"/>
     
    <xsl:if test="$idNodePicker = $idProject">
     
    <div class="mainNewsItem">
      <div class="container">
        <div class="img">
          <a href="{umbraco.library:NiceUrl(@id)}">
            <img width="235" height="176" border="0">
            <xsl:attribute name="src">
            <xsl:value-of select="topArticleImage"/>
            </xsl:attribute>
            <xsl:attribute name="alt">
            <xsl:value-of select="articleAltText"/>
            </xsl:attribute>
            </img>
          </a>
        </div>
        <div class="copyContainer">
          <div class="copyHeader">
            <a href="{umbraco.library:NiceUrl(@id)}" class="headerLink"><xsl:attribute name="title"><xsl:value-of select="articleAltText"/></xsl:attribute>
              <xsl:value-of select="articleHeadline"/>
            </a>
          </div>
          <div class="copy"><xsl:value-of select="articleLongDescription"/></div>
        </div>
        <div class="moreContainer"><a href="{umbraco.library:NiceUrl(@id)}" class="moreLink">[read more +]</a></div>
      </div>
    </div>
     
    </xsl:if>
    </xsl:for-each>
    </xsl:for-each>
     
    </xsl:template>

  • Lee Kelleher 4026 posts 15836 karma points MVP 13x admin c-trib
    Mar 27, 2013 @ 16:39
    Lee Kelleher
    0

    HI RokkaD,

    I know it's been a good few days since you posted this. Were you able to sort this, or do you still need help?

    Cheers, Lee.

  • RokkaD 2 posts 22 karma points
    Apr 29, 2013 @ 16:02
    RokkaD
    0

    Hi Lee,

    Thank you so much for posting a reply and offering to help. I did manage to sort it out and would have posted my solution but by the time i'd found a solution I'd make so many changed that I'm not completely sure which bit of code sorted it. Apologies for not replying until now but I registered with this forum with an email I don't regularly check (In hindsight not a very sensible thing to do).

    I have another problem with paging so I'm going to post that up as a new topic and see if I can get anywhere with that. :o)

    Thanks very much again.

Please Sign in or register to post replies

Write your reply to:

Draft