Jump to content

Pagination error: renderPager() returns same markup on every page


Ivan Gretsky
 Share

Recommended Posts

On 10/01/2017 at 7:34 PM, Ivan Gretsky said:

Good day!

Suddenly I stumbled upon pagination once again. Pagination itself works as expected, but renderPager() returns the same markup on every paginated page. So it is 1st page current on every /pageN/. What can cause this? Please help.

Hi @Ivan Gretsky do you have the code? I have working pagination on a site and may be able to help. My (stripped down version) of news-index is like this:

// news-index.php
<?php
    $entries = $pages->find("template=news-entry, limit=9, sort=sort"); //9 articles per page
    $pagination = $entries->renderPager();
?>


<div class="page-tabs-wrapper">
    <div class='page-tabs'>
        <div class='upper'>
           <?php echo $pagination; ?> 
        </div>
    </div>
</div>

<div id='news-row'>
	<?php foreach ($entries as $entry): ?>

        <div class='news-column'>
            A NEWS ENTRY
        </div>
  
	<?php endforeach; ?>
</div>

I had to also set 'Admin > Setup > Templates > Edit Template: news-index'. Go to URLs tab and check 'Allow page numbers'. 

 

  • Like 1
Link to comment
Share on other sites

Thanks. I think I got it all right, as the pagination actually works, and the pager does display/ But it is the same on every paginated page.
I implemented pagination several times, so there is either a typo or some stupid error in the code I just could not find going through code a million times, or some limitation/bug I do not know about.

Link to comment
Share on other sites

13 hours ago, Ivan Gretsky said:

so there is either a typo or some stupid error in the code I just could not find going through code a million times, or some limitation/bug I do not know about.

Can you share the code of the template where the pagination is? I always find an extra pair of eyes is helpful as it's easy to miss something when you're staring at it over and over.

  • Like 1
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

×
×
  • Create New...