Thursday, October 8, 2015

what is the simple concept for pagination

pagination required mathematics..
its easy to make any kind of pagination.

lets have a look in php.

<?php
$current_page=((isset($_REQUEST['page']) && ($_REQUEST['page']!=""))?$_REQUEST['page']:1);
$next_page=$current_page+1;
$page_limit=5;
$page_from=(($current_page*$page_limit)-$page_limit);
echo $page_from.'-'.$page_limit;
?>


Hit url like http://yourdomain.com?page=1

Hit url like http:127.0.0.1/myprojec_page.php?page=1

No comments:

Post a Comment