stopping infinite scroll

3 posts by 2 authors in: Forums > CMS Builder
Last Post: June 7, 2016   (RSS)

By Damon - June 7, 2016

Hi Jason,

I'm not sure how the infinite scroll jquery plugin works but you could start with code like this:

<?php if($newsMetaData['totalPages'] < @$_REQUEST['page']) : ?>
    Go to 404
<?php endif; ?>

The $newsMetaData['totalPages'] is the total number of pages. Change the name to match your section editor name.

The @$_REQUEST['page'] is grabbing the page number from the URL. The @ symbol suppresses errors if there isn't a page variable to get.

Not sure if you need to redirect to a 404 or something else. 

Let me know if this works for you and which infinite scroll jquery plugin you are using.

Thanks!

Cheers,
Damon Edis - interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

By squeazel - June 7, 2016

Thanks Damon! I wrapped my entire code displaying the CMS records inside your code, but changed it to >= instead of <, and it worked.