Jump to content
Peter Falkenberg Brown

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

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');


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

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


Any help would be greatly appreciated.



Share this post

Link to post
Share on other sites


// ...
$results->setStart(6); // index = 7 - 1
$pagination = $pager->render($results);


Share this post

Link to post
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

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...