Copied to clipboard

Flag this post as spam?

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


  • Fuji Kusaka 2203 posts 4220 karma points
    Jul 04, 2011 @ 10:09
    Fuji Kusaka
    0

    Paging

    Hi guys,

    I have a news XSLT where there is about 20items being displayed monthly and to make this more user friendly i added a pagintor but its not showing up. To this has anything to do with the fact that am using the macros in the eidtor?

    here is the piece of code am using

     

    <xsl:variable name="source" select="/macro/source"/>
    <xsl:variable name="itemsToDisplay" select="1"/>
    <xsl:variable name="numberOfItems" select="count($currentPage/* [@isDoc and string(umbracoNaviHide) != '1'])"/>
        
    <!-- Paging -->
    <xsl:variable name="pageNumber">
      <xsl:choose>
        <xsl:when test="umbraco.library:RequestQueryString('page') = ''">
          <xsl:value-of select="1"/>
        </xsl:when>
        <xsl:otherwise>
          <xsl:value-of select="umbraco.library:RequestQueryString('page')"/>
        </xsl:otherwise>
      </xsl:choose>
    </xsl:variable>    
        
    <xsl:template match="/">

    <!-- The fun starts here -->
    <ul>
    <xsl:for-each select="umbraco.library:GetXmlNodeById($source)/* [@isDoc and string(umbracoNaviHide) != '1']">
       <xsl:sort select="current()/eventDate" order="descending"/>
          <xsl:if test="position () &lt;= $itemsToDisplay">
            <li class="eventLink">
                  <a href="{umbraco.library:NiceUrl(@id)}"><xsl:value-of select="eventTitle"/>     
              </a>
            </li>
          </xsl:if>
    </xsl:for-each>
    </ul>
      
      <xsl:if test="$pageNumber &gt; 1">
      <a href="?page={$pageNumber -1}#events">previous &nbsp;</a>
    </xsl:if>
      
      <xsl:call-template name="for.loop">
      <xsl:with-param name="i"> 1 </xsl:with-param>
      <xsl:with-param name="count" select="ceiling($numberOfItems div $itemsToDisplay)"></xsl:with-param>
    </xsl:call-template>  
      
    <xsl:if test="(($pageNumber) * $itemsToDisplay) &lt; ($numberOfItems)">
      <a href="?page={$pageNumber+1}#events">&nbsp; next</a>
    </xsl:if>
      
      </xsl:template>
      
        <xsl:template name="for.loop">
                    <xsl:param name="i"/>
                    <xsl:param name="count"/>
                    
                    <xsl:if test="$i &lt;=$count">
                            <xsl:if test="$pageNumber!= $i">
                                    <a href="?page={$i}#events"><xsl:value-of select="$i" />&nbsp;</a>
                            </xsl:if>

                            <xsl:if test="$pageNumber = $i">
                                     <xsl:value-of select="$i"/>&nbsp;
                            </xsl:if>

                            <xsl:call-template name="for.loop">
                                    <xsl:with-param name="i" select="$i + 1" />
                                    <xsl:with-param name="count" select="$count">
                                    </xsl:with-param>
                            </xsl:call-template>
                    </xsl:if>

    </xsl:template>
Please Sign in or register to post replies

Write your reply to:

Draft