We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 45765
    • 2 Posts
    Hello

    I have two snippets in order to output resources in two ways - the first in a large box, the rest in a list.

    [[!getPage@pagination? &elementClass=`modSnippet` &element=`getResources` &tpl=`news-lrg-tpl-blog` &parent=`2` &limit=`1` &includeTVs=`1` ]]
    
    [[!getPage@pagination? &elementClass=`modSnippet` &offset=`1` &element=`getResources` &tpl=`news-index-tpl` &parent=`2` &limit=`16` &includeTVs=`1` ]]


    But the offset isn't working, so the first also appears in the second area, which I don't want. Also, as you go through the pagenation, the link in the top box changes, rather than remaining the latest post. Eg on page 2 it shows the 2nd to last post, page 3 shows the 3rd to last post etc.

    Here is the actual page;

    http://www.djcdesign.co.uk/blog

    Thanks, David
    • You use getPage twice on the same page - and both of them use the GET parameter "page" (by default) to calculate the offset. This messes everything up. There's no need for the first getPage call. Do one getResources (for the very first entry) and one getPage (for the rest with paging).
      [[!getResources?
      	&tpl=`news-lrg-tpl-blog`
      	&parents=`2`
      	&limit=`1`
      	&includeTVs=`1`
      ]]
      [[!getPage@pagination?
      	&elementClass=`modSnippet`
      	&offset=`1`
      	&element=`getResources`
      	&tpl=`news-index-tpl`
      	&parents=`2`
      	&limit=`16`
      	&includeTVs=`1`
      ]]

      And for getResources it's "parents", not "parent".
        • 45765
        • 2 Posts
        hi labr1005

        thanks for response - makes sense - solution solves the pagenation issue

        however - the offset still doesn't work - the first item still appears in the second list - no biggy but annoying !

        thanks, david
          • 37110
          • 72 Posts
          That's because you have the offset specified inside the getPage call.     &offset=`1`
          If you want 1 on each page the limit has to be 1.
            • 6723
            • 93 Posts
            Quote from: wiegers at Nov 26, 2013, 01:03 PM
            That's because you have the offset specified inside the getPage call. &offset=`1`
            If you want 1 on each page the limit has to be 1.

            First call is the one I only want one - hence it is limited to 1. The second call, getPage, I would like only 16 and they to be offset by one, so not duplicating the item in the first call. Hopefully that makes sense.

            At the moment - first item appears twice - http://www.djcdesign.co.uk/blog/
            • You can't set the offset of a getPage call, because it inherently has to calculate the offset property for paging the results.
                • 6723
                • 93 Posts
                thanks Jason - thought i was going crazy as used the offset function for getResources successfully elsewhere but now understand why it doesn't work for getPage
                  • 42046
                  • 436 Posts
                  I use a modified version of getPage to enable the offset function.

                  Duplicate the snippet. At line 16 add:

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


                  then use &offset=`value` [ed. note: absent42 last edited this post 10 years, 7 months ago.]
                    • 6723
                    • 93 Posts
                    thanks for responding Dan - tried it but didn't work for me