Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Tips and Tutorials
I have enabled pagination in my app and it works great. I would like to add a pagination summary with the format; "Showing x to y records of z"
Any help will be greatly appreciated.
You have the start row, the number of entries, and the total (as they are all input for Pagination).
So you can add that to your view without any problems?
It is not really pagination itself, as all that does is generate the pagination navigation block.
Pardon me - I just realized my question was vague. Starting over below;
one of my views, I have a dynamically populated table with pagination
setup and it is working correctly. A quick summary of the view;
<page header here>
<pagination here - displayed with pagination render>
<summary here >
<page footer here>
I would like the <summary> to display "Showing 1 to 5 of 12 records" for page 1 and "Showing 6 to 11 of 12 records" for page two and so on.
Is it possible to get this information from the pagination object in the controller? If so, how?
I pondered your earlier statement and achieved what I wanted with the code below.
$stpl = "Showing  %s  to  %s  of  %s  records";
$current_page = $open_tickets['pagination']->current_page;
$limit = $open_tickets['pagination']->per_page;
$total_items = $open_tickets['pagination']->total_items;
$from = (($current_page * $limit) - $limit + 1);
$to = min( ($current_page * $limit), $total_items );
Thank you for the guidance.
Assuming $pagination is your pagination object:
First row: $pagination->offset;
Last row: $pagination->offset + $pagination->per_page - 1;
Total rows: $pagination->total_items;
That should do it.
And if you use the static interface and the default object, use:
You can find the list of properties here:
Our posts crossed...
Add a Comment
It looks like you're new here. If you want to get involved, click one of these buttons!
Apply for Membership
↳ Job Board
↳ Installation & Setup
↳ Tips and Tutorials
↳ Code share
In this Discussion