szalik.dev Posted November 5, 2016 Share Posted November 5, 2016 Hello, is there any topic saying how to properly configure a Pagination for IPB4? I'm making sort of Player Panel and there is like 25k rows to display and I need to do a Pagination but I didn't found any topic saying something about Pagination that I understand... Link to comment Share on other sites More sharing options...
TAMAN Posted November 5, 2016 Share Posted November 5, 2016 Link to comment Share on other sites More sharing options...
szalik.dev Posted November 5, 2016 Author Share Posted November 5, 2016 Yeah but there is no "source", idk how to use this code.. Link to comment Share on other sites More sharing options...
bfarber Posted November 7, 2016 Share Posted November 7, 2016 Pagination is generally easy - for the most part it is handled in the templates. {template="pagination" group="global" app="core" location="global" params="$table->baseUrl, $table->pages, $table->page, $table->limit, TRUE, $table->getPaginationKey()"} The parameter list is The base URL Total number of pages The current page The number of items per-page TRUE or FALSE whether to support AJAX page loading The page parameter (i.e. ?page=3) in the URL TRUE or FALSE whether to use simple pagination (usually leave this FALSE) On the backend you need to figure out the page number coming in and then multiple it by the number of items per page to determine your SQL offsets. If there is no page number (or it is less than 1...keep in mind users can play with URLs) then use 1. If you find that the offset you create by multiplying the page number times the number of items per page is more than the number of items you have, you may wish to reset to the last page (again, remember that users can play with URLs and send ?page=10000000 just because they want to see if they can break your application). Now, if you use \IPS\Helpers\Table (there are subclasses here you should look at, you probably want \IPS\Helpers\Table\Db) most of this is taken care of for you. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.