Jump to content

Using MarkupPagerNav::setPageNum() to start pagination at specific page number


Peter Falkenberg Brown
 Share

Recommended Posts

Hi Folks,

I am stuck, after scouring the API docs, module code, and forum questions.

I'm trying to write code that upon the initial pressing of a search button will set the page number to something other than 1.

For example, the query might return 50 pages, but I want to start by showing page 7, with the pagination boxes appearing on both sides of the highlighted box 7.

Here's my code (setPageNum will only be used if it's an initial search button press (which I'll check with a hidden form field)).

      $results = $pages->find("$select_limit");

      $pager = $modules->get('MarkupPagerNav');
      $pager->setNumPageLinks($numPageLinks);

      $pager->setPageNum(7);

      $pagination = $pager->render($results);

The returned pagination all looks good EXCEPT that it always starts at page 1 instead of page 7, like this:

image.png.520d2b7c4e41082f3614870ebb5ecaf7.png

Any help would be greatly appreciated.

Peter

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...