Pagination Gallery Options
Ig_p118
Posted: Monday, December 03, 2007 1:01:21 PM

Rank: Fanatic

Joined: 7/21/2006
Posts: 315
Location: Salerno - Italy
How Can I create paging on photo gallery?
That is: I have 100 photos then I wish divede them in 10 photos a page.

Thanks

Red Consulting s.a.s - Umbraco from v1.0
tim
Posted: Monday, December 03, 2007 1:13:11 PM

Rank: Addict

Joined: 2/19/2007
Posts: 819
Location: Belgium
Hi,

Check out this example:

http://tim.netcentric.be/2007/3/23/paging-example.aspx

Good luck !

Umbraco tips and tricks: http://www.nibble.be - umbraco mvp 08/09 - certified level 1 & 2 professional
Ig_p118
Posted: Monday, December 03, 2007 1:19:48 PM

Rank: Fanatic

Joined: 7/21/2006
Posts: 315
Location: Salerno - Italy
I had tested that example, but don't work for me, because I have error on reading XLST file or if I'don't have error, I see nothing.

I'm going to try.

Thanks

Red Consulting s.a.s - Umbraco from v1.0
Ig_p118
Posted: Monday, December 03, 2007 1:25:46 PM

Rank: Fanatic

Joined: 7/21/2006
Posts: 315
Location: Salerno - Italy
I've got to pass some parameters to XLST?

Red Consulting s.a.s - Umbraco from v1.0
tim
Posted: Monday, December 03, 2007 1:39:32 PM

Rank: Addict

Joined: 2/19/2007
Posts: 819
Location: Belgium
Nope no parameters needed in the example, items per page is a fixed value inside the xslt

Code:

<xsl:variable name="recordsPerPage" select="1"/> 




Umbraco tips and tricks: http://www.nibble.be - umbraco mvp 08/09 - certified level 1 & 2 professional
Ig_p118
Posted: Monday, December 03, 2007 2:11:47 PM

Rank: Fanatic

Joined: 7/21/2006
Posts: 315
Location: Salerno - Italy
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xsl:Stylesheet [ <!ENTITY nbsp "&#x00A0;"> ]>
<xsl:stylesheet
    version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:msxml="urn:schemas-microsoft-com:xslt"
    xmlns:umbraco.library="urn:umbraco.library"
    exclude-result-prefixes="msxml umbraco.library">


<xsl:output method="xml" omit-xml-declaration="yes"/>

<xsl:param name="currentPage"/>   
     
<xsl:template match="/">   
   
 
<xsl:variable name="recordsPerPage" select="2"/>   
     
<xsl:variable name="pageNumber" >   
         <xsl:choose>       
                     <!-- first page -->       
                     <xsl:when test="umbraco.library:RequestQueryString('page') <= 0 or string(umbraco.library:RequestQueryString('page')) = '' or string(umbraco.library:RequestQueryString('page')) = 'NaN'">0</xsl:when>       
                     <!-- what was passed in -->       
                     <xsl:otherwise>       
                         <xsl:value-of select="umbraco.library:RequestQueryString('page')"/>   
                     </xsl:otherwise>       
                </xsl:choose>       
     
</xsl:variable>   
     
<xsl:variable name="numberOfRecords" select="count($currentPage/node)"/>       
     
     
<xsl:template match="/">     
           

<xsl:for-each select="$currentPage/node [string(data [@alias='umbracoNaviHide']) != '1']">
    
<xsl:if test="(position() > $recordsPerPage * number($pageNumber)) and       
  (position() <= number($recordsPerPage * number($pageNumber) +       
  $recordsPerPage))">

     <div class="Item">

        <!-- get first photo thumbnail -->
        <a href="{./data [@alias='ThumbImage']}" rel="lightbox[galleria]">
            <img src="{./data [@alias='ThumbImage']}" width="90" height="90" alt="{@nodeName}"/>
        </a>

    </div>

</xsl:if>

</xsl:for-each>

<xsl:if test="$pageNumber > 0">   
   <a href="?page{$pageNumber -1}">Rew</a>   
   </xsl:if>   
       
   <xsl:if test="(($pageNumber +1 ) * $recordsPerPage) < ($numberOfRecords)">   
   <a href="?page={$pageNumber +1}">Fwd</a>   
   </xsl:if>

</xsl:template>

</xsl:stylesheet>


Red Consulting s.a.s - Umbraco from v1.0
Users browsing this topic
Guest


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.