Copied to clipboard

Flag this post as spam?

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


  • Patrick 23 posts 83 karma points
    Mar 06, 2012 @ 20:53
    Patrick
    0

    Structure problem

    I am working on a portfolio-site, which has the following structure:

    category
    + project 1
      + Image 1
      + Image 2
    + project 2
      ....

    I have the following code within my xslt to creat an overview of projects on my category page:

    <ul>
      <xsl:for-each select="$currentPage/* [@isDoc and string(umbracoNaviHide) != '1']">
        <li><a href="{umbraco.library:NiceUrl(@id)}">
        <xsl:value-of select="@nodeName"/>
        </xsl:if>
        </a></li>
    </xsl:for-each>
    </ul>

    What I really would want is to expand this code, so the first image of the first child is shown within the href instead of the nodeName. This way the image of: 'Image 1' is shown as the image for project 1.

    The image is called display.

    Any help is welcome...

  • Kim Andersen 1447 posts 2196 karma points MVP
    Mar 06, 2012 @ 21:13
    Kim Andersen
    1

    Hi Patrick

    Maybe something like the following can help you:

    <ul>
      <xsl:for-each select="$currentPage/* [@isDoc and string(umbracoNaviHide) != '1']">
        <li><a href="{umbraco.library:NiceUrl(@id)}">
        <xsl:if test="./*[@isDoc][1]/display != '' ">        

            <xsl:variable name="media" select="umbraco.library:GetMedia(./*[@isDoc][1]/display,0)"/>

            <img src="$media/umbracoFile" alt="$media/@nodeName" />

        </xsl:if>
        </a></li>
    </xsl:for-each>
    </ul>

    /Kim A

  • Patrick 23 posts 83 karma points
    Mar 06, 2012 @ 21:33
    Patrick
    0

    Thanks Kim,

    You made my day!

    Greetings, Patrick

  • Kim Andersen 1447 posts 2196 karma points MVP
    Mar 06, 2012 @ 21:36
    Kim Andersen
    0

    Great! Glad to hear that Patrick :)

    /Kim A

Please Sign in or register to post replies

Write your reply to:

Draft