⚠️ Urgent! Active Attacks on MODX Revolution Sites Below Revolution 2.6.5
Subscribe: RSS
  • Hello,

    Situation:

    I'm using the Collections addon for my Blog. On my homepage I show the 7 most recent resources. I've created a total of 8.

    I intend to use getPage to add pagination.
    So with getPage installed, I used the following snippet call inside my home template:

    [[!getPage? &element=`getResources` &parents=`2` &limit=`2` &showHidden=`1`]]
                      <ul class="pagination pagination-sm">[[!+page.nav]]</ul>
    


    Result:

    I get 4 page results while it should have shown 2! Anyway, then when I click on page 2 of 4, the URL nicely shows:
    domain.com/index.php?id=2&page=2


    but I get the same page in return, which is page one basically :S

    What am I missing?

    Thanks,
    John

    This question has been answered by Bruno17. See the first response.

    • Mistake one:
      [[!getPage? .... ` &limit=`2` ...]]


      Should be 7:

      [[!getPage? .... ` &limit=`7` ...]]


      That solved the page result issue. But I still have the problem of not getting to the next page result.

      Extra troubeshoot info:
      This value has no impact on the amount of resources displayed.
      In admin > Extras > Collection Views --> General Settings:

      Page size = 7
      

      .

      The blogit.get_posts chunk:
      [[blogit.lexicon_load]]
      [[!getResources?
      	&parents=`[[*id]]`
      	&tpl=`blogit.blog_row_tpl`
      	&includeTVs=`1`
      	&processTVs=`1`
      	&tvPrefix=``
      	&where=`[[!TaggerGetResourcesWhere]]`
              &showHidden=`1`
              &limit=`0`
      ]]


      Altering the &limit value is respected. But getPage can not overrule the limit by decrease or increase. [ed. note: kenjiro last edited this post 1 year ago.]
      • usually, you replace getResources with getPage.
        It seems, you have just added getPage(without a tpl) and have still getResources in use?
          -------------------------------

          you can buy me a beer, if you like MIGX

          http://webcmsolutions.de/migx.html

          Thanks!
        • Quote from: Bruno17 at Nov 12, 2017, 11:30 AM
          usually, you replace getResources with getPage.
          It seems, you have just added getPage(without a tpl) and have still getResources in use?

          Hi Bruno, according to the manual:
          This Snippet does nothing by itself, but rather depends on another Snippet to return the output for a specified page (or range of data within a complete set). For example, the getResources, getFeed, and Archivist Snippets can both be wrapped by getPage.

          So if the manual @ https://docs.modx.com/extras/revo/getpage is correct, something else is either not configured correctly, or I have found a bug?

          [EDIT]
          One problem after another. I've got paging working now, but now the images from the resources are not showing up. I can go on for days troubleshooting, with an online manual, that was written from an expert's point of view. It's hard to make much sense out of it.

          This is what I now have in the main navigation menu of my overview site template:
          <ul class="pagination pagination-sm">[[!+page.nav]]</ul>
          


          In the content section of the same site template:
          [[!getPage? &elementClass=`modSnippet` &element=`getResources` &parents=`2` &depth=`2` &limit=`7` &tpl=`my_blogPost_container_tpl` ]]
          

          [ed. note: kenjiro last edited this post 1 year ago.]
          • discuss.answer
            you replace just this:
            [[!getResources?
                &parents=`[[*id]]`
                &tpl=`blogit.blog_row_tpl`
                &includeTVs=`1`
                &processTVs=`1`
                &tvPrefix=``
                &where=`[[!TaggerGetResourcesWhere]]`
                    &showHidden=`1`
                    &limit=`0`
            ]]
            


            with something like this:

            [[!getPage?
                &element=`getResources`
                &parents=`[[*id]]`
                &tpl=`blogit.blog_row_tpl`
                &limit=`7`
                &includeTVs=`1`
                &processTVs=`1`
                &tvPrefix=``
                &where=`[[!TaggerGetResourcesWhere]]`
                &showHidden=`1`
            ]]
            


            you need &includeTVs=`1` and maybe &processTVs=`1` to get TVs showing
              -------------------------------

              you can buy me a beer, if you like MIGX

              http://webcmsolutions.de/migx.html

              Thanks!
            • Quote from: Bruno17 at Nov 12, 2017, 04:03 PM
              you replace just this:
              ...

              with something like this:

              [[!getPage?
                  &element=`getResources`
                  &parents=`[[*id]]`
                  &tpl=`blogit.blog_row_tpl`
                  &limit=`7`
                  &includeTVs=`1`
                  &processTVs=`1`
                  &tvPrefix=``
                  &where=`[[!TaggerGetResourcesWhere]]`
                  &showHidden=`1`
              ]]
              


              you need &includeTVs=`1` and maybe &processTVs=`1` to get TVs showing

              That did the job! Thanks for helping out Bruno.

              This did it!
              &element=`getResources`