We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 32678
    • 290 Posts
    I am trying to modify the default getPage output to show ONLY the Previous and Next nav buttons.

    I've edited the default pageNavOuterTpl placeholder to include only [[+prev]][[+next]] within a property set called pageNav.

    I replaced the default pagination call / placeholder that ships with Articles as follows:

    [[!getPage@pageNav?
      &elementClass=`modSnippet`
      &element=`getResources`
      &parents=`[[~8]]`
    ]]
    
    [[!+page.nav:notempty=`<ul class="pageList">[[!+page.nav]]</ul>`]]


    This accomplishes nothing -- pagination still includes everything I don't want, even though I removed the default pagination call and placeholder.

    I'm obviously not getting something, and the getPage documentation is about as clear as mud to me.

    Can someone please steer me right here? [ed. note: wpicotte last edited this post 9 years, 10 months ago.]
    • You can't feed the &parents property a URL, and [[~8]] makes a URL.

      A good idea is to set up a getResources snippet to generate what you want, then use the same properties in the getPage snippet.

      getPage acts as a wrapper for the getResources snippet, and passes its properties on to the internal getResources snippet call, so you have to give it all of the same properties you would give the getResources snippet.
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 32678
        • 290 Posts
        Quote from: sottwell at Jun 20, 2014, 02:24 AM
        You can't feed the &parents property a URL, and [[~8]] makes a URL.

        So stupid. I've been staring at this for way too long.

        Quote from: sottwell at Jun 20, 2014, 02:24 AM
        A good idea is to set up a getResources snippet to generate what you want, then use the same properties in the getPage snippet.

        getPage acts as a wrapper for the getResources snippet, and passes its properties on to the internal getResources snippet call, so you have to give it all of the same properties you would give the getResources snippet.

        OK, so you're saying get a getResources call working, and then take those properties and apply them to a getPage call. That makes sense.

        A remaining point of confusion for me about this, though, is how to build a getResources to call that achieves the pagination I seek. Will using the custom property set and the edited, default getPage templates within work in this scenario?

        I'm sure this is fundamental, but it's totally murky to me.
        • getResources generates the list of items. getPage only provides the pagination, breaking your list up into sections and providing the prev/next or numbering controls. So forget about getPage until getResources makes the list you want. Then put the properties from that getResources call into the getPage snippet call.

          Consider the runSnippet() function. It takes two arguments, the name of the snippet to run, and an array of properties to pass on to the snippet. For example,
          runSnippet('getResources', array('parents'=>8, 'tpl'=>'myTplChunk');

          Basically that is what getPage is doing internally. That means that you have to give getPage all of the properties you want the getResources snippet to have, because getPage has to pass them on to its getResources snippet call.

          The paging properties listed on the getPage documentation apply to getPage itself only. They have no bearing on how the internal listing snippet gets run. You have to supply the properties needed by that listing snippet.
            Studying MODX in the desert - http://sottwell.com
            Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
            Join the Slack Community - http://modx.org
            • 32678
            • 290 Posts
            Quote from: sottwell at Jun 20, 2014, 03:08 AM
            getResources generates the list of items. getPage only provides the pagination, breaking your list up into sections and providing the prev/next or numbering controls. So forget about getPage until getResources makes the list you want. Then put the properties from that getResources call into the getPage snippet call.

            Consider the runSnippet() function. It takes two arguments, the name of the snippet to run, and an array of properties to pass on to the snippet. For example,
            runSnippet('getResources', array('parents'=>8, 'tpl'=>'myTplChunk');

            Basically that is what getPage is doing internally. That means that you have to give getPage all of the properties you want the getResources snippet to have, because getPage has to pass them on to its getResources snippet call.

            The paging properties listed on the getPage documentation apply to getPage itself only. They have no bearing on how the internal listing snippet gets run. You have to supply the properties needed by that listing snippet.

            Susan, thank you. You just explained how this works far more effectively than the documentation. You should run workshops!