Paging literally means making data displayed in multiple pages. Paging is used specially for website, where displaying large amount of data can be so troublesome by making the downloaded data bigger and thus increasing the response time. Paging can be done in many ways. In this tutorial, I would like to show you a very simple method we can use to do the paging. Here, we just need to enable the user to move to the next page (if any) and back to the previous page (if any). Also, for the sake of simplicity, I will use dummy data stored hard-codedly into an array. However, the concept is similar. OK, let's start !!! /* Maximum number of items to show, per page */ $maxItemPerPage = 10 ; /* * Prepare the dummy data * Used just for the sake of this tutorial. */ $data = array ( ) ; for ( $i = 1 ; $i <= 112 ; $i ++ ) array_push( $data , "Item " . $i ) ; First of all, we define the maximum number of items to show per page. In...
Comments
Post a Comment