Page List Pagination

Permalink 1 user found helpful
I've added a Page List block and I've checked the option to display pagination (Pagination: Display pagination interface if more items are available than are displayed.).

Well that works just fine, but how can I change the pagination function?! The view.php has got this code to run the pagination function.
if ($paginate && $num > 0 && is_object($pl)) {
   $pl->displayPaging();
}
But I can't discover where to find this function in Concrete.

Can anybody help me? I want to change the standard HTML coding of this function:
<div class="ccm-spacer"></div>
<div class="ccm-pagination">
   <span class="ccm-page-left">
      <span class="ltgray">« Previous</span>
   </span>
   <span class="ccm-page-right">
      <span class=""><a href="/nieuws?ccm_paging_p_b290=2" >Next »</a>
      </span>
   </span>
   <span class='currentPage'>
      <strong>1</strong>
   </span>
   <span class=''>
      <a href='/nieuws?ccm_paging_p_b290=2' >2</a>
   </span>

NUL76
 
davygee replied on at Permalink Reply
I need to be able to style up the paginate feature as well, any help would be brilliant.
jordanlev replied on at Permalink Reply
jordanlev
Depending on what kind of customization you want, you might be able to do this by creating a custom template for the page_list block (by copying yoursite/concrete/blocks/page_list/view.php to yoursite/blocks/page_list/view.php) and changing the "$pl->displayPaging();" code in that new file to something like this:
<?php
$summary = $pl->getSummary();
if ($summary->pages > 1):
   $paginator = $pl->getPagination();
?>
   <div class="ccm-spacer"></div>
   <div class="ccm-pagination">
   <span class="ccm-page-left"><?php echo $paginator->getPrevious('Your own custom Previous Entries Link Text'); ?></span>
   <span class="ccm-page-right"><?php echo $paginator->getNext('Your own custom Next Entries Link Text'); ?></span>
   <?php echo $paginator->getPages(); ?>
   </div>
<?php endif; ?>


...or whatever it is you want to do with the html. Check out the yoursite/concrete/helpers/pagination.php file to see what functions are available from the $paginator object.

Hope that helps!

-Jordan Lev

UPDATE: I've posted a write-up about this here:
http://c5cookbook.com/recipes/customize_page_list_pagination_links...
MrNiceGaius replied on at Permalink Reply
MrNiceGaius
Great write up, exact details on how to customize the pagination from a page list template. thanks Jordan!!!
Tony replied on at Permalink Best Answer Reply
Tony
there's a pagination class in /concrete/helpers/pagination.php

you should be able to find some example of how to use it if you just search for:

Loader::helper('pagination');
davygee replied on at Permalink Reply
I can't overwrite the concrete core directory as I'm with the official C5 hosting. Is there a way I could call the same function up outwith the concrete/helpers folder to get it to work. Cheers for all your help.
mose replied on at Permalink Reply
mose
You never want to overwrite Concrete core files, no matter who is hosting your web site. If you want to change core functionality, copy pagination.php to the site "helpers" directory at the top level and change your copy to suit your needs. You are responsible, then, for making any additional changes to your code when new versions of Concrete5 are installed.
davygee replied on at Permalink Reply
If I copy the pagination.php from the concrete helpers folder and place in the root helpers folder it states the following:

Fatal error: Cannot redeclare class paginationhelper in /home/barrandwray/public_html/helpers/pagination.php on line 20

What can I do to sort this out?
mose replied on at Permalink Reply
mose
If all you did was copy the file to the top-level helpers directory, then this is a bug. Files in the helpers directory (and all other top-level directories) should override files on the corresponding concrete directories.

If you modified the file and duplicated the paginationhelp class, that would cause the error you see. That gets into the realm of PHP programming.
BigBobbyD replied on at Permalink Reply
BigBobbyD
davygee - Did you ever get this sorted?

I'm having the same problem in 5.4.0. Copying the pagination.php to the root /helpers folder throws the exact same error. The file is not modified at all: copied as-is from /concrete/helpers.

There must be a way to modify the view of the page list pagination, but I haven't found it after more than an hour of searching around the forums.

Per Andrew's advice here:http://www.concrete5.org/community/forums/customizing_c5/page_list-... , I'm calling on the page_list class directly, rather than instantiating a block, and therefore I can't attach a template to it, as suggested here (at least I don't think I can?):http://www.concrete5.org/community/forums/customizing_c5/pagination...

If you have made any progress, I would be very grateful for a little help!
mose replied on at Permalink Reply
mose
After looking at the code, I discovered that helpers are different from blocks, models and libraries. At this time, you cannot override a helper with a local file. I have submitted a patch to make helpers like the other items, and I am waiting for feedback on the patch. See this thread.

http://www.concrete5.org/community/forums/customizing_c5/bug-report...
madmichael replied on at Permalink Reply
madmichael
I know this is an older thread, but for reference everything can now be overridden in a package using overrideCoreByPackage Seehttp://www.concrete5.org/community/forums/customizing_c5/override-a... for examples