We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 8168
    • 1,118 Posts
    Hi,

    I have a getPage call which includes pagination as per the example code below. This all works fine when I call the getPage call uncachned - but, to speed up page load, I want to call it cached - if I do this, the pagination does not work - clicking on the 2nd page button brings up the 1st page - it just plain and simply does not work...

    Can the pagination not work if the getPage call is cached???

    [[!getPage?
       &elementClass=`modSnippet`
       &element=`getResources`
       &parents=`20,32,305`
       &limit=`12`
       &pageVarKey=`page`
       &includeTVs=`1`
       &processTVs=`1`
       &includeContent=`1`
       &tpl=`NewsArticleTpl`
       &tvPrefix=``
       &sortby=`{"publishedon":"DESC"}`
       &showHidden=`1`
       &pageNavVar=`Both.nav`
       &includeTVList=`myTVs`
        ]]
    
    
        <div class="paging">
        <ul class="pageList">
        [[+Both.nav]]
        </ul>
        </div>
    


    Anyone any ideas?

    e.g. changing the code to below means the pagination fails:

    [[getPage?
       &elementClass=`modSnippet`
       &element=`getResources`
       &parents=`20,32,305`
       &limit=`12`
       &pageVarKey=`page`
       &includeTVs=`1`
       &processTVs=`1`
       &includeContent=`1`
       &tpl=`NewsArticleTpl`
       &tvPrefix=``
       &sortby=`{"publishedon":"DESC"}`
       &showHidden=`1`
       &pageNavVar=`Both.nav`
       &includeTVList=`myTVs`
        ]]
    
    
        <div class="paging">
        <ul class="pageList">
        [[+Both.nav]]
        </ul>
        </div>
    

      • 4172
      • 5,888 Posts
      of course, it can't work, when called cached.
      Each page is another request with different results.
      But getPage has its own caching.
      Read:
      https://docs.modx.com/extras/revo/getpage#getPage-CachingProperties
        -------------------------------

        you can buy me a beer, if you like MIGX

        http://webcmsolutions.de/migx.html

        Thanks!
        • 8168
        • 1,118 Posts
        Quote from: Bruno17 at Apr 12, 2017, 03:24 PM
        of course, it can't work, when called cached.
        Each page is another request with different results.
        But getPage has its own caching.
        Read:
        https://docs.modx.com/extras/revo/getpage#getPage-CachingProperties

        Thanks Bruno - didn't think it could but wanted to check! I tried adding &cache=`1` to the call as a parameter but that didnt seem to work either...?
          • 8168
          • 1,118 Posts
          Anyone any ideas if its possible for the pagination to work without calling the [[!getPage]] - e.g. calling it [[getPage]] (cached)!. Cached call makes the page load so much quicker I need it to work cached...
            • 8168
            • 1,118 Posts
            Apparently this is not possible - so as my goal is to speed up the getPage call but cant do that via calling it cached - I will need to use pdoTools rather than getPage for those interested and reading this.