• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Undocumented features of the Pagination Class

#1
[eluser]spider pig[/eluser]
I have been writing a blog where the post, comments form and comments are on the same page.

The problem I had was when I used the Pagination class for the comments, the next page of comments would load but it would load at the top of the page - where the post is and not at the comments at the bottom of the page.

Normally you would use an anchor to jump to the correct section but I could not see how to do this with the Pagination Class documentation. However, looking at the class code, I noticed some more options - "prefix" and "suffix". These are placed inside the links, so:

Code:
$config['suffix'] = '#comments_list';

adds the anchor link to the end of the URL:

Code:
<a href="/news/article/2009/07/21/First_Entry/10#comments_list">3</a>

Of course a better solution would be to use ajax to load the page of comments rather than re-loading the page. Maybe that's for the next version Smile


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.