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: [Dave] Pagination Errors

By rasbro - December 21, 2007

My only concern was regarding errors when a page is not found. I understand that content on a page will change as products are added and removed. I will upgrade and then test again to see how it handles the changes to the perPage option.

If you do have suggestions for a way to make a missing list result page redirect to the default page 1, I would be greatful.

Thanks,
Brian

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