Modifying the default Paging display in Concrete5.

Permalink
I was stuck in the modification of the design of the default pagination on a page today. The only solution I found was to copy the "view.php" file from the "concrete/blocks/page_list" folder to the "blocks/page_list/templates" folder in the root directory. But, the problem was that I had to use this new template in a block, which I didn't want to create.

So, after digging into the "Item List" class of Concrete5 for pagination, I figured out a solution.

The default summary shown by the displaySummary() function is like "Viewing 1 of 10 pages (100 total)".

Suppose, I need it like "Page 1 of 10 | Total : 100". To do this you can use the following code and modify it as you may require:
Page <?php echo $paginationHelper -> getRequestedPage(); ?> of  <?php echo $paginationHelper -> getTotalPages(); ?> | Total : <?php echo $paginationClass -> getTotal(); ?>


$paginationHelper -> getRequestedPage() returns the current page that the user is viewing.
$paginationHelper -> getTotalPages() returns the total pages fetched in the result.
$paginationClass -> getTotal() returns the total no. of records fetched in the result. (This function is contained in the Class ItemList, but the above two functions are there in the PaginationHelper Class)

Also, to modify the default Previous and Next links text returned by the $paginationClass -> getPrevious() and $paginationClass -> getNext() functions, pass the required text as a parameter in the respective functions. For e.g.,
$paginationClass -> getPrevious('Previous') and $paginationClass -> getNext('Next')


The above information was fetched from the following links:
http://docs.mnkras.com/class_item_list.html...
http://docs.mnkras.com/class_pagination_helper.html...

I found this information useful, so thought of sharing it.

coolguru4ever
 
Mnkras replied on at Permalink Reply
Mnkras
woohoo! my docs! gotta update them actually

You should submit this as a how-to, also try using [code] blocks for readability
coolguru4ever replied on at Permalink Reply
coolguru4ever
Thanks for the appreciation.

This was just my first post to the forums, so didn't have that much knowledge. I'll submit it to the how-to as u suggested.