We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
  • Some projects needs pagination when working with a lot of albums.

    Is it possible to make [[GalleryAlbums]] to support getPages Snippet?
    I searched trought the snippet and couldn't find any placeHolder to get the total ammount of galleries in the call so i can later call something like this (note the last property):

    [[!getPage?
    
    &elementClass=`modSnippet` 
    &element=`GalleryAlbums` 
    &albumRequestVar=`album` 
    &rowTpl=`galAlbumRowWithCoverTpl` 
    &prominentOnly=`0` &parent=`10`
    &thumbQuality=`75`
    &limit=`5` 
    
    &totalVar=`totalGalleries`
    ]]


    and then be able to paginate the list of albums with a chunk like this:?

    <div class="paging">
    <ul class="pageList">
    [[!+page.nav]]
    </ul>
    </div>



    Created an issue/feature request at Github with this, just in case.
    https://github.com/splittingred/Gallery/issues/244


    After getting $albums in the snippet code i can make somethink like
    $totalGalleries = count($albums);
    

    But i dont know how to put this value available in a separate placeholder after running the snippet.

    Can anyone point me in the right direction?
    [ed. note: lithiumlab last edited this post 11 years, 4 months ago.]
      • 21395
      • 91 Posts
      I've added my support for this idea on GitHub. In the meantime, I'm using multipe GalleryAlbum calling pages, each calling 12 Album covers, each with &start=`12`, (or `24`, or `36` etc) in the GalleryAlbum snippet call.
        MODX Revolution 2.6.5-pl (traditional)

        Hosted on MODX Cloud

        Skype: nicbaldeagle
        • 31640
        • 100 Posts
        Add the following two lines to the galleryAlbums snippet and it works. I added it after line 40

        $offset = isset($offset) ? (integer) $offset : 0;
        $scriptProperties['start'] = $offset;