Jump to content

Recommended Posts

Posted

Hello all. I've been lookin' at this for a couple of days now with no luck.

I have a localhost test site where I set up an example as shown in example #2 in this article.

The test template has page numbers enabled. There are 20 pages using the test template.

$results = wire('pages')->find("template=test,sort=-published,limit=12");
$pagination = $results->renderPager();
echo $pagination;
foreach($results as $result){
	blah, blah, blah
}

The pager is rendered correctly, ie., 1 2 Next, including the link href attributes: ?page=2 for the second and Next links. The problem is the same pages are returned regardless of which link I click. There are no error messages. The response header shows page 2. Tracy shows the following for $results:

count => 12
total => 20
start => 0
limit => 12
pager => "1 to 12 of 20" (13)
items => array (12)

What am I missing?

Thanks for your help!

Posted
1 hour ago, rick said:

The test template has page numbers enabled.

1 hour ago, rick said:

including the link href attributes: ?page=2 for the second and Next links

Are you 100% sure you have "Allow Page Numbers" checked in the template settings? Your links should be like "/page2/". A link like "?page=2" and the same results on every pagination is usually a sign that page numbers have not been enabled for the template.

Posted

Okay, I see where you are going wrong. You need to enable pagination for the template that is listing the results, not for the template of pages you are getting in your find() selector.

  • Like 2

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...