PAGINATION limit

3 posts by 2 authors in: Forums > CMS Builder
Last Post: February 12, 2010   (RSS)

Re: [esteban] PAGINATION limit

By Chris - February 12, 2010

Hi esteban,

A lot of websites will only show you a certain number of pages in both directions from the current page (e.g. if you are on page 7, you might see 4,5,6,[7],8,9,10). This still allows users to navigate all the pages, but doesn't overwhelm them with too many numbers. Is this what you want to do?

If so, try replacing this line:

<?php foreach (range(1,$newsMetaData['totalPages']) as $page): ?>

with this:

<?php
$startNumber = max($current_page - 3, 1);
$endNumber = min($current_page + 3, $newsMetaData['totalPages']);
?>

<?php foreach (range($startNumber,$endNumber) as $page): ?>


I hope this helps! Please let me know if you have any questions or if this doesn't address your issue.
All the best,
Chris

Re: [chris] PAGINATION limit

This is it, working :-) Thanks for help.