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

    I have been trying to create pagination on a page and I can't seem to get it to work. My html

    <nav class="pagination">
            <ul>
              <li class="pages"><strong>Page 1 of 2</strong></li>
              <li class="current"><strong>1</strong></li>
              <li><a href="#">2</a></li>
              <li><a href="#">Next »</a></li>
            </ul>
          </nav>
    


    I was previously using a getpage style taken from here:

    http://codingpad.maryspad.com/2011/07/07/modx-revolution-for-complete-beginners-part-11-using-getpage-to-add-pagination/

    But I cannot understand how to integrate the navigation comands into the above template. Any pointers to start me off would be great please

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

      www.PawsForWildlife.co.uk
      www.Borntobrick.co.uk
    • discuss.answer
      • 13226
      • 953 Posts
      At a guess:

      [[!getPage@newsPaging?
      &elementClass=`modSnippet`
      &element=`getResources`
      &showHidden=`1`
      &tpl=`newsTpl`
      &limit=`3`
      &includeContent=`1`
      &includeTVs=`1`
      &processTVs=`1`
      &parents=`[[*id]]`
      &hideContainers=`1`
      &pageLimit=`5`
      &pageNavVar=`page.nav`
      ]]
      
      <nav class="pagination">
        <ul>
          <li class="pages"><strong>Page [[+page]] of [[+pageCount]]</strong></li>
          [[!+page.nav]]
        </ul>
      </nav>


      pageNavTpl:
      <li><a href="[[+href]]" title="[[+pageNo]]">[[+pageNo]]</a></li>

      pageActiveTpl:
      <li class="current"><strong>[[+pageNo]]</strong></li>

      pagePrevTpl:
      <li><a href="[[+href]]">« Prev</a></li>

      pageNextTpl:
      <li><a href="[[+href]]">Next »</a></li>
        • 7527
        • 437 Posts
        Works a treat thankyou! Now to finish the templates...
          www.PawsForWildlife.co.uk
          www.Borntobrick.co.uk