Pagination Errors

4 posts by 2 authors in: Forums > CMS Builder
Last Post: December 22, 2007   (RSS)

By rasbro - December 21, 2007

When I set the "$options['perPage']" in List view to say 5 and then later change it to 15 to include more listings per page, I see a potential issue with link/bookmark errors.

For example: When the "$options['perPage']" is 5 and I navigate through the pages of listings and then bookmark the address of one of the pages (ie: www.sitedomain.com/mypageList.php/page2/page1/page2), and then after changing the "$options['perPage']" to 15 which eliminates the need for the page2, the bookmarked link is not found because there is only 1 page and page2 does not exist anymore.

Aside from the obvious option that we should never change the "$options['perPage']" value in the future, is there another option to avoid this issue and allow us some flexibility in future site changes?

Thanks for any ideas or advice on this!

Brian

Re: [rasbro] Pagination Errors

By Dave - December 21, 2007

Hi Brian,

Ok, a few things. You shouldn't have an urls with "/page#" repeating on the end. If after upgrading to the latest version that still happens let us know. It doesn't cause problems but it looks nicer if it doesn't repeat.

Next, to answer your question. Not only will the results of page 2 change if you the perPage value does. They'll also change as you add and remove records. Just like when you bookmark a page of results from google what's on the page will change.

But, it should be pretty easy to have it do just about anything you like. You could have it display an error message when there is no page (like it does now), redirect to page 1 or some other page, or something else.

What would you like it to do?
Dave Edis - Senior Developer
interactivetools.com

Re: [rasbro] Pagination Errors

By Dave - December 22, 2007

Sure, we're going to make this the default for the next version (v1.06), but here's some instructions if you want that feature right away:

- upgrade to v1.05
- replace the following with attached files:
/lib/viewer_functions.php
/lib/menus/database/showViewerCode_functions.php
- either generate your list viewer code again or replace the "no record were found" code with this:

<?php if ($listDetails['noRecordsFound']): ?>
No records were found!<br/>
<?php endif ?>

<?php if ($listDetails['invalidPageNum']): ?>
Results page not found,
<a href="<?php echo $listDetails['firstPageLink'] ?>">start over &gt;&gt;</a>.<br/>
<?php endif ?><br/>


That will make it easy for users to get back to the first page. To auto redirect just use a meta redirect tag or javascript with $listDetails['firstPageLink'] as the url.

Hope that helps!
Dave Edis - Senior Developer
interactivetools.com