<![CDATA[ Revolution Gallery - how to add pagination - My Forums]]> https://forums.modx.com/thread/?thread=37769 <![CDATA[Re: Revolution Gallery - how to add pagination]]> https://forums.modx.com/thread/37769/revolution-gallery---how-to-add-pagination?page=2#dis-post-494600
Quote from: eugen.t at Oct 10, 2012, 09:30 PM
There is another solution without editing getPage snippet source code.
Step 1. Create wrapper chunk for Gallery snippet [[$gallery_wrapper]]:
[[!Gallery?  
&limit=`[[+limit]]`
&start=`[[+offset]]`
&album=`your_gallery_id`
]]

Step 2. Call getPage snippet with this parameters:
[[!getPage?
&elementClass=`modChunk`
&element=`gallery_wrapper`
&limit=`5`
&totalVar=`gallery.total`
]]

<div>
<span>Page [[+page]] of [[+pageCount]]</span>
[[!+page.nav]]
</div>

Unfortunately i only get 5 Pictures and no "next Page" link and the page count is always 1. Can anyone point me to my mistake? Thanks a lot for helping!


EDIT:

I found another post and was ablet to get everything working - here is my code (I use prettyGallery)

[[!If? &subject=`[[*prettyGalleryAlbum]]` &operator=`!empty` &then=`<div class="pagination">Page [[+page]] of [[+pageCount]] <ul>[[!+page.nav]]</ul></div>`]]
[[!If? &subject=`[[*prettyGalleryAlbum]]` &operator=`!empty` &then=`[[!getPage?
&elementClass=`modSnippet`
&element=`Gallery`
&album=`[[*prettyGalleryAlbum]]`
&thumbTpl=`prettyGalleryImageTpl`
&thumbWidth=`[[*prettyThumbnailWidth]]`
&thumbHeight=`[[*prettyThumbnailHeight]]`
&useCss=`0`
&limit=`15`
&totalVar=`gallery.total`
]]`]]
[[!If? &subject=`[[*prettyGalleryAlbum]]` &operator=`!empty` &then=`<div style="clear:both"></div>`]]
[[!If? &subject=`[[*prettyGalleryAlbum]]` &operator=`!empty` &then=`<div class="pagination">Page [[+page]] of [[+pageCount]] <ul>[[!+page.nav]]</ul></div>`]]

]]>
flanger Apr 09, 2014, 08:28 AM https://forums.modx.com/thread/37769/revolution-gallery---how-to-add-pagination?page=2#dis-post-494600
<![CDATA[Re: Revolution Gallery - how to add pagination]]> https://forums.modx.com/thread/37769/revolution-gallery---how-to-add-pagination?page=2#dis-post-488474 http://forums.modx.com/thread/88803/gallery-getpage-pagination-problem#dis-post-488472
Thank you in advance!]]>
deyand Jan 27, 2014, 02:06 PM https://forums.modx.com/thread/37769/revolution-gallery---how-to-add-pagination?page=2#dis-post-488474
<![CDATA[Re: Revolution Gallery - how to add pagination]]> https://forums.modx.com/thread/37769/revolution-gallery---how-to-add-pagination?page=2#dis-post-474571 Quote from: bazpaul at Feb 22, 2012, 04:22 AM
On my site I would love to add a button that just says "Next Album" or "Previous Album"

Could be done by https://github.com/Jako/Gallery/blob/patch-1/core/components/gallery/elements/snippets/snippet.galleryalbums.php

and a containerTpl like this:

<a href="[[~[[*id]]? &[[+albumRequestVar]]=`[[+nav.prev]]`]]">Previous Album</a> | <a href="[[~[[*id]]? &[[+albumRequestVar]]=`[[+nav.next]]`]]">Next Album</a>
]]>
Jako Aug 10, 2013, 01:33 PM https://forums.modx.com/thread/37769/revolution-gallery---how-to-add-pagination?page=2#dis-post-474571
<![CDATA[Re: Revolution Gallery - how to add pagination]]> https://forums.modx.com/thread/37769/revolution-gallery---how-to-add-pagination?page=2#dis-post-465312 zzhelev May 04, 2013, 03:21 AM https://forums.modx.com/thread/37769/revolution-gallery---how-to-add-pagination?page=2#dis-post-465312 <![CDATA[Re: Revolution Gallery - how to add pagination]]> https://forums.modx.com/thread/37769/revolution-gallery---how-to-add-pagination?page=2#dis-post-439685 Step 1. Create wrapper chunk for Gallery snippet [[$gallery_wrapper]]:
[[!Gallery?  
&limit=`[[+limit]]`
&start=`[[+offset]]`
&album=`your_gallery_id`
]]

Step 2. Call getPage snippet with this parameters:
[[!getPage?
&elementClass=`modChunk`
&element=`gallery_wrapper`
&limit=`5`
&totalVar=`gallery.total`
]]

<div>
<span>Page [[+page]] of [[+pageCount]]</span>
[[!+page.nav]]
</div>
]]>
eugen.t Oct 10, 2012, 04:30 PM https://forums.modx.com/thread/37769/revolution-gallery---how-to-add-pagination?page=2#dis-post-439685
<![CDATA[Re: Revolution Gallery - how to add pagination]]> https://forums.modx.com/thread/37769/revolution-gallery---how-to-add-pagination?page=2#dis-post-437938
Snippet code:


[[getPage?
    &elementClass=`modSnippet`
    &element=`Gallery` 
    &totalVar=`gallery.total`
    &limit=`4`
    &album=`1`
    &useCss=`0`
    &toPlaceholder=`gallery`]]



getPage Snippet, add this line, somewhere after the
$properties['offset']
has been set, I choose line 41 and added:

$properties['start'] = $properties['offset'];


I found the solution of a Russian modx page and it worked relatively flawlessly http://community.modx-cms.ru/blog/questions/6454.html

I'm still trying to get it work with &sort variable, for some reason, when sorting the items with &sort = `rand` it repeats some of the items, resulting in incorrect pagination.]]>
tourshi Sep 22, 2012, 05:53 PM https://forums.modx.com/thread/37769/revolution-gallery---how-to-add-pagination?page=2#dis-post-437938
<![CDATA[Re: Revolution Gallery - how to add pagination]]> https://forums.modx.com/thread/37769/revolution-gallery---how-to-add-pagination?page=2#dis-post-413009
I dont want to have pages for thumbs but for albums.

To achieve this effect manually i simply have to change the galAlbum number below in my link to cycle the photography page to the next album.
http://www.antsinmyspacebar.com/modx/barry-oneill-photography.html?galAlbum=9


Can this be done?

(sorry if unclear im still a modx n00b)]]>
bazpaul Feb 22, 2012, 04:22 AM https://forums.modx.com/thread/37769/revolution-gallery---how-to-add-pagination?page=2#dis-post-413009
<![CDATA[Re: Revolution Gallery - how to add pagination]]> https://forums.modx.com/thread/37769/revolution-gallery---how-to-add-pagination?page=2#dis-post-403073
[[!getPage?
    &elementClass=`modSnippet`
    &element=`Gallery` 
    &totalVar=`gallery.total`
    &limit=`6`
    &album=`1`
    &pageVarKey=`page`
    &start=`page`
]]


And add in snippet Gallery before
/* check for REQUEST vars if property set */

this code:
if ($start == 'page') {
    $page = ($_GET['page'] ? $_GET['page'] : 1);
    $start = $limit * ($page - 1);
}
]]>
schizoinside Dec 11, 2011, 08:50 AM https://forums.modx.com/thread/37769/revolution-gallery---how-to-add-pagination?page=2#dis-post-403073
<![CDATA[Re: Revolution Gallery - how to add pagination]]> https://forums.modx.com/thread/37769/revolution-gallery---how-to-add-pagination?page=2#dis-post-213702
getPage snippet
    $totalSet = $modx->getPlaceholder($properties['totalVar']);
    if(empty($totalSet)){
        $totalSet = $modx->getPlaceholder('gallery.total');
    }


]]>
mopmodx Jul 15, 2011, 05:12 AM https://forums.modx.com/thread/37769/revolution-gallery---how-to-add-pagination?page=2#dis-post-213702
<![CDATA[Re: Revolution Gallery - how to add pagination]]> https://forums.modx.com/thread/37769/revolution-gallery---how-to-add-pagination?page=2#dis-post-213701

if (!empty($limit)) $c->limit($limit,$start);

$total = $modx->getCount('galItem',$c); //get total amount for the getPage snippet
$modx->setPlaceholder('total', $total); // set total amount for the getPage snippet

//in getPage snippet

    $totalSet = $modx->getPlaceholder($properties['totalVar']);
return $modx->getPlaceholder($properties['totalVar']);

//first page return 43 .. second page page=2 return 0



How do I solve it?]]>
mopmodx Jul 15, 2011, 04:26 AM https://forums.modx.com/thread/37769/revolution-gallery---how-to-add-pagination?page=2#dis-post-213701