• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Pagination - Inactive Prev and Next Links

#1
[eluser]underskor[/eluser]
Today I was setting up pagination, and realised that there seems to be no option to allow 'Next' and 'Previous' links to be displayed when you are at the end of the result range (they disappear by default). I was after a uniform look, so I made a couple of quick adjustments to the pagination library to allow this, and thought I'd share incase anyone finds it useful. Similarly, these modifications would provide direction if you wish to do the same for the 'First' & 'Last' links.

It may be best do the following modifications in reverse order, to avoid line number references becoming incorrect.

system/libraries/Pagination.php
Code:
//Line 49 - Insert the following
var $next_tag_open_inactive    = '<span class="nextInactive">'; //Values set for example
var $next_tag_close_inactive   = '</span>';
Code:
//Line 51 - Insert the following
var $prev_tag_open_inactive    = '<span class="prevInactive">';
var $prev_tag_close_inactive   = '</span>';
Code:
//Line 198 - Insert the following
else
{
    $output .= $this->prev_tag_open_inactive.$this->prev_link.$this->prev_tag_close_inactive;
}
Code:
//Line 223 - Insert the following
else
{
    $output .= $this->next_tag_open_inactive.$this->next_link.$this->next_tag_close_inactive;
}

If anyone has any comments or suggestions, I'd be interested to hear them.

#2
[eluser]xwero[/eluser]
You could try out my pagination plugin for the same flexibility.

With the plugin you can add this in the template file based on the existence of the $prev and $next variables.

The first and last link don't disappear because IMO those links are constants.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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