We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 31104
    • 108 Posts
    Quick question, I couldn't find any (probably didn't search correctly) information on how to display the number of resources shown in the list.

    In other words, let's say I have a list of 50 resources and getPage shows them in lists of 10. So is there a way to get the total amount of resources and on page 3 say: "Showing items 30 to 39 of 50" ?

    Thanks in advance for any help.

      • 31104
      • 108 Posts
      Ok I found this thread that shows a similar question:

      https://forums.modx.com/thread/43623/displaying-total-number-of-resources-with-getresources

      And thanks to opengeek's reply I learned about the totalVar property, which is pretty good, so I just add &totalVar=`nameofplaceholdertouse` and put the place holder in my tpl chunk.

      But how could I also show the just the number of resources being pulled by getPages? in order to get something like this:

      "Showing: 1-10 of 30 items"

      Is this possible with getResources or getPage?

        • 31104
        • 108 Posts
        Lol, it was right in front of my nose the whole time XD

        [[!+firstItem]] - [[!+lastItem]] of [[!+total_pages]]


        (total_pages) being the name of the placeholder used with &totalVar=`total_pages`

        Sorry for making anyone read this sad (or in the best case, hope it helped another rookie like me)