Copied to clipboard

Flag this post as spam?

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


  • Hundebol 167 posts 314 karma points
    Nov 05, 2009 @ 15:54
    Hundebol
    0

    Showing number 7 an onwards

    Hi all,

    Having puzzled with this for a while, and traversing the forums hasn't helped me coming closer to a solution.

    What i have
    On one page i show some thumbnails of some some magazine covers - this was easy. I use a macro parameter called "maxItems" so that it only shows the first 6 magazine covers. This was piece of cake - so far so good.

    What i want
    On the same page i want to make somekind of "Archive" - where i show magazine number 7, 8, 9 and so on further down the list. but i can't figure this one out! So please help med on this one.

    My XSLT for showing the first 6 magazine covers looks like this:

        <xsl:param name="currentPage"/>
        <xsl:variable name="maxItems" select="/macro/maxItems"/>
        <xsl:param name="MaxNoChars" select="150" />
        <xsl:variable name="level" select="4"/>
        <xsl:template match="/">

    <xsl:for-each select="$currentPage/descendant-or-self::node [@level=$level]/node [string(data [@alias='umbracoNaviHide']) != '1']">

        <!-- THE IF, WILL TEST HOW MANY ITEMS TO SHOW -->
        <xsl:if test="position() &lt;= $maxItems">
            <div id="BWnewsMagazine">
            <h2>
            <!-- Month - taken from the node name-->
            <xsl:value-of select="@nodeName" disable-output-escaping="yes"/>
             
            <!-- Year - taken from the node/folder name-->               
            &nbsp;<xsl:value-of select="../@nodeName" disable-output-escaping="yes"/>
            </h2>

        <!-- THE PHOTO OF THE NEWS MAGAZINE -->
                <xsl:variable name="englishfile" select="umbraco.library:GetMedia(number(./data[@alias='BWnewsFile']),'false')"/>
                    <a href="{$englishfile/data[@alias='umbracoFile']}">
                    <img style="border: none;">
                    <xsl:attribute name="src">
                    <xsl:value-of select="umbraco.library:GetMedia(data [@alias = 'BWnewsPhoto'], 'false')/data [@alias = 'umbracoFile']"/>
                    </xsl:attribute>
                    </img>  
                </a>

    My content tree looks like this:

    - Magazine page (where i show the first six AND the archive)
    -- Year
    --- Month
    ---- Magazine Cover

    The cover picture and the file (to download) is chosen via Media pickers, if that makes any difference.

    Hope that someone is able to help me out a bit.

    br/
    Hundebol

  • dandrayne 1138 posts 2262 karma points
    Nov 05, 2009 @ 16:05
    dandrayne
    0

    Hi There

    Hows about just

    <xsl:choose>
    <xsl:when
    test="position() &lt;= $maxItems">
    <!-- less than or equal to 6 loop -->
    </xsl:when>
    <xsl:when test="position() &gt; $maxItems">
    <!-- greater than 6 loop -->
    </xsl:when>

    </xsl:choose>
  • dandrayne 1138 posts 2262 karma points
    Nov 05, 2009 @ 16:06
    dandrayne
    1

    oops,

    or even

    <xsl:choose>
    <xsl:when
    test="position() &lt;= $maxItems">
    <!-- less than or equal to 6 loop -->
    </xsl:when>
    <xsl:otherwise>
    <!-- greater than 6 loop -->
    </xsl:otherwise>

    </xsl:choose>

    Dan

  • Hundebol 167 posts 314 karma points
    Nov 05, 2009 @ 16:35
    Hundebol
    0

    Hi Dan,

    Thanks for your help - i turner out that it was all in all just me being stupid!

    I just changed my

    <xsl:if test="position() &lt;= $maxItems">

    to

    <xsl:if test="position() &gt;= $maxItems">

    And then it worked!

    I am sure i had already tried this "&gt" before, with errors to follow - but apparently the problem then was, that the XSLT made a rendering error, because i only had exactly 6 covers to show - there had to be 7. So thank you Dan, you pointed me in the right direction.

    br/
    Hundebol

Please Sign in or register to post replies

Write your reply to:

Draft