Copied to clipboard

Flag this post as spam?

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


  • Bas Schouten 135 posts 233 karma points
    Nov 30, 2012 @ 11:40
    Bas Schouten
    0

    Nodes per month

     

    Hi All,

    I used the following script to display nodes per month. http://our.umbraco.org/forum/developers/xslt/6928-Grouping-nodes-by-Month?p=0#comment25245 ;

    The result loops the month name like this:

     

    This is the full code:

     

    <xsl:template match="/"> 
    <xsl:variable name="eventNodes" select="$currentPage//Agendaitem [umbraco.library:DateGreaterThanOrEqualToday(datum)]"/>

    <xsl:for-each select="$eventNodes">
      <xsl:sort select="datum"/>
      <xsl:variable name="lastMonth" select="umbraco.library:FormatDateTime(datum,'MMMM')" />
     
    <xsl:if test="not(preceding-sibling::node[umbraco.library:FormatDateTime(datum,'MMMM')=$lastMonth])">

    <h2 class="dotted">
              <xsl:value-of select="position()"/><xsl:value-of select="umbraco.library:FormatDateTime(datum,'MMMM - yyyy')" />
            </h2>
            <div class="ctr-events">
              <ul>
            <xsl:for-each select="$eventNodes[umbraco.library:FormatDateTime(datum,'MMMM')=$lastMonth]">
              <xsl:sort select="datum"/>
                            <li>
                             <div class="info">
                                    <div class="title">
                                      <a href="{umbraco.library:NiceUrl(@id)}">
                                            <xsl:value-of select="@nodeName"/>
                                      </a>
                                    </div>
                              </div>
                              <div class="clear"><xsl:text> </xsl:text></div>
                            </li>    
            </xsl:for-each>
              </ul>
            </div>
      </xsl:if>
    </xsl:for-each>

     

     

    Does anyone knows how to show the month only once?

     

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Nov 30, 2012 @ 19:48
    Jan Skovgaard
    0

    Hi Bas

    Try having a look at this answer by Chriztian explaining some Muanchin grouping here http://our.umbraco.org/forum/developers/xslt/14952-Grouping-Using-the-Muenchian-Problem#comment68628

    Also have a look at his answer in here: http://our.umbraco.org/forum/developers/xslt/17142-Simple-Muenchian-grouping

    Hope this helps.

    /Jan

  • 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