getResources and Pagination

I have a getResources with a chunk that brings back results of football matches. The getResources is below:

[[!pdoResources? &parents='8' &tpl='gameUpcomingHome' &includeContent='1' &processTVs='1' &includeTVs='Team_1_Name, Team_1_Score, Team_1_Crest, Team_2_Name, Team_2_Score, Team_2_Crest, Name_Competition, Game_Date, Game_Venue' &limit='3' &offset='1' &sortby='{"Cluiche_Date":"DESC"}' &sortdir='DESC' &where='{"isfolder:=":"0","template:=":"15"}' ]]

Is it possible to add pagination to this to see the next 3 results?

For getResources, usually getPage is used for the pagination:

https://extras.modx.com/package/getpage


For pdoResources, use pdoPage from the same extra.

Can pdoPage be used with pdoResources also? And if so how? How do you link it back to a specific pdoResources?

pdoPage uses pdoResources by default.

Just add the same properties you use for pdoResources to the pdoPage call.

Working through it now. It works :smiley: Can I ask, is it possible to do this were it doesn’t refresh page and add page2 to the url. So when you click 2 or next it would do it there and then?

Take a look at the “ajaxMode” section of the documentation:

1 Like

This is my code but when I press next or page 2, it refreshes. The ajax part doesn’t seem to work

<div id="pdopage">
  <div class="rows">
    [[!pdoPage?
      &parents=`8`
      &ajaxMode=`default`
      &tpl=`gameResultsHome`
      &includeContent=`1`
      &processTVs=`1` 
      &includeTVs=`Team_1_Name,
        Team_1_Score,
        Team_1_Crest,
        Team_2_Name,
        Team_2_Score,
        Team_2_Crest,
        Game_Competition,
        Game_Date,
        Game_Venue`
      &limit=`6` 
      &sortby=`{"Game_Date":"DESC"}`
      &sortdir=`DESC`
      &where=`{"isfolder:=":"0","template:=":"15"}`
    ]]
  </div>
  [[!+page.nav]]
</div>

The Ajax mode of pdoPage requires jQuery to work.
Make sure you added the jQuery library to your template.

1 Like