Good idea making a small project for this sample :-)
A suggestion for a modification: You will easily run into the problem of the list of pages becoming waaay too long (e.g. 10000 records with 20 shown on each page). Luckily the "XSLTSearch guys" already solved this. It is relatively simple to replace the "for.loop" template call with their "pageNumbers" template. Here's how my version ended up looking:
<!-- paged results template (modified from XSLTSearch) --> <xsl:template name="pageNumbers"> <xsl:param name="page"/> <xsl:param name="pageIndex"/> <xsl:param name="numberOfRecords"/> <xsl:variable name="distanceFromCurrent" select="$pageIndex - $page"/> <xsl:choose> <xsl:when test="$pageIndex = $page"> <!-- current paged set --> <strong> <xsl:value-of select="$pageIndex"/> </strong> </xsl:when> <!-- show a maximum of nine paged sets on either side of the current paged set; just like Google does it --> <xsl:when test="($distanceFromCurrent > -10 and $distanceFromCurrent < 10)"> <a href="{umbraco.library:NiceUrl($currentPage/@id)}/?page={$pageIndex}" > <xsl:value-of select="$pageIndex" /> </a> </xsl:when> </xsl:choose> <!-- recursively call the template for all the paged sets --> <xsl:if test="$pageIndex * $recordsPerPage < $numberOfRecords"> <xsl:call-template name="pageNumbers"> <xsl:with-param name="pageIndex" select="$pageIndex + 1"/> <xsl:with-param name="page" select="$page"/> <xsl:with-param name="numberOfRecords" select="$numberOfRecords"/> </xsl:call-template> </xsl:if> </xsl:template>
Made a version where the amount of pages shown is always the same. So if you are at the first page, there will be more "next pages", and if you are at the last page, more "previous" pages will be shown:
Showing only x previous/next pages
Good idea making a small project for this sample :-)
A suggestion for a modification:
You will easily run into the problem of the list of pages becoming waaay too long (e.g. 10000 records with 20 shown on each page).
Luckily the "XSLTSearch guys" already solved this. It is relatively simple to replace the "for.loop" template call with their "pageNumbers" template. Here's how my version ended up looking:
Made a version where the amount of pages shown is always the same. So if you are at the first page, there will be more "next pages", and if you are at the last page, more "previous" pages will be shown:
(not thoroughly tested - but it seems to work :-)
is working on a reply...