Overriding Pagination HTML

Permalink
Hi

I am trying to override the HTML generated by the Pagination system, it seems like it should be pretty simple but I cannot find any decent documentation on how to do it.

I have found the following class:

http://documentation.concrete5.org/api/class-Concrete.Core.Search.P...

I want to override the getArguements method of this class so that I can remove the arrow HTML entities but I cannot find away to override this class.

Can anyone point me in the right direction?

Many thanks
David

bvcreative
 
jakobfuchs replied on at Permalink Reply
jakobfuchs
I tried to do that once, but didn't go through with it, because it's not very straightforward.

What I learned was:

- c5 useshttps://github.com/whiteoctober/Pagerfanta... for pagination
- You can and probably must create custom templates for Pagerfanta

No idea how to make c5 aware of these custom templates or where they should go.

Also see here:http://www.concrete5.org/community/forums/customizing_c5/replacing-...
bvcreative replied on at Permalink Reply
bvcreative
Hi jakobfuchs

Many thanks for your answer, I am shocked that there isn't more about this for 5.7, this seems to be such fundamental thing to me. Being forced to have arrows by the system seems like such an archaic system when I am sure most modern developers will be using icon fonts etc for handling these things.

Thanks for the github link, I will dig into this a little further and if I have any success I will update the post.

All the best
David
MrKDilkington replied on at Permalink Reply
MrKDilkington
@jakobfuchs
@bvcreative

I believe this tutorial is what you are looking for:
"Styling the pagination - 5.7"
http://documentation.concrete5.org/tutorials/styling-the-pagination...
jakobfuchs replied on at Permalink Reply
jakobfuchs
That should do the trick, it would be really nice though to have that implemented at the theme level like custom layouts for example. Or at least provide a function to set a custom pagination view in page_theme.php like for grid systems. I think most theme developers don't want to dive that deep into the code to switch out the pagination markup.
MrKDilkington replied on at Permalink Reply
MrKDilkington
@jakobfuchs

This might be something to suggest on GitHub.
bvcreative replied on at Permalink Reply
bvcreative
Hi

Many thanks for postiing this, that has definitely helped. There is an issue though with code in Code-7. The getArguments Method should be:

public function getArguments()
   {
      return array(
         'previous_message' => 'Prev',
         'next_message' => 'Next'
      );
   }


The difference is as stated in the thread prev_message should be previous_message.

Also if it helps anyone, I overrode my createDetaultTemplate method to add some additional options:

protected function createDefaultTemplate()
   {
      $template = new \Pagerfanta\View\Template\DefaultTemplate();
      $options = array(
         'container_template' => '<nav class="pagination-wrapper"><ul class="pagination">%pages%</ul></nav>',
         'page_template'      => '<li><a href="%href%">%text%</a></li>',
         'span_template'      => '<li><span class="%class%">%text%</span></li>'
      );
      $template->setOptions($options);
      return $template;
   }


If you look in the DefaultTemplate file you will see the available options at the top.

Many thanks
David
goodsir replied on at Permalink Reply
goodsir
FYI I created a more 'SEO' friendly paginator which includes rel='prev' and rel='next' links.

https://github.com/jeffharrisgoodsir/seo_pagination...
helenmarie replied on at Permalink Reply
helenmarie
Hi, Does this work with 8.1?
DeFrae1 replied on at Permalink Reply
Call me dumb but where do you upload this to and how do you make it work?