Jump to content

Pagination link


kaz
 Share

Recommended Posts

I have for a news site (Lister Pro) a pagination with MarkupPagerNav.

$results = $pages->find("limit=5, template=news, sort=-publish_from");
echo $results->renderPager(array(
'nextItemLabel' => "vor",
'previousItemLabel' => "zurück",
'listMarkup' => "<ul class='MarkupPagerNav uk-margin-medium-top'>{out}</ul>",
'itemMarkup' => "<li class='{class}'>{out}</li>",
'linkMarkup' => "<a href='{url}'><span>{out}</span></a>"
));

The pagination is displayed but does not work. The link is output as follows:
http://192.168.64.2/news/?page=2

When I click the link, the same page is reloaded, not page 2.
I have 7 entries, with limit 5, 5 entries are correctly displayed on news page 1. I am worried about the news/?page=2, shouldn't it be news/page2 ?

Link to comment
Share on other sites

@netcarverAllow Page Numbers was already activated. Without activation the pagination would not work (!?), but it works. Only the link to the pages, the URL, I think is wrong <a href='{url}'><span>{out}</span></a>. The link is surely not wanted like that: ?page=2

Link to comment
Share on other sites

@kaz If you are sure that you are looking at the correct template in the admin then I'm out of ideas. The code in the MarkupPagerNav class may have a subtle error that I can't spot, but I'd expect to see the url you are actually seeing if that "Allow Page Numbers" setting was not set. Here's the code on Github.  Is there anywhere else in your code or modules that might be clearing the allowPageNum setting on that template?

Link to comment
Share on other sites

On 7/14/2021 at 3:18 PM, netcarver said:

@kaz If you are sure that you are looking at the correct template in the admin then I'm out of ideas. The code in the MarkupPagerNav class may have a subtle error that I can't spot, but I'd expect to see the url you are actually seeing if that "Allow Page Numbers" setting was not set. Here's the code on Github.  Is there anywhere else in your code or modules that might be clearing the allowPageNum setting on that template?

It's a good consideration. I set it up this way: I have a base template. In it I load per include the news template. The news template has only the code I need to display the articles.

I only have a summary, because I didn't manage to build the whole thing including a detail page.
I have activated Allow Page Numbers only in the included news template.

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