Pagination

Rob Loach - May 19, 2008 - 08:44
Project:iUI
Version:6.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:active
Description

The pagination on lists of content doesn't work because the secondary links take over the page when you choose a new page.

#1

burgs - March 3, 2009 - 14:54
Version:<none>» 6.x-1.x-dev

I've made a small change that seems to make pagination function like iui should.

Create template.php or ammend the existing to have this function:

function phptemplate_pager($tags = array(), $limit = 10, $element = 0, $parameters = array(), $quantity = 9) {
  global $pager_page_array, $pager_total;

  // Calculate various markers within this pager piece:
  // Middle is used to "center" pages around the current page.
  $pager_middle = ceil($quantity / 2);
  // current is the page we are currently paged to
  $pager_current = $pager_page_array[$element] + 1;
  // first is the first page listed by this pager piece (re quantity)
  $pager_first = $pager_current - $pager_middle + 1;
  // last is the last page listed by this pager piece (re quantity)
  $pager_last = $pager_current + $quantity - $pager_middle;
  // max is the maximum page number
  $pager_max = $pager_total[$element];
  // End of marker calculations.
 
if ($pager_current < $pager_max){
return '<li>' . theme('pager_link', (isset($tags[3]) ? $tags[3] : t('More...')), pager_load_array($pager_page_array[$element] + 1, $element, $pager_page_array), $element, $parameters, array('target' => '_replace')) . '</li>';
}
}

and i added this code into page.tpl.php

// Special use case for paginated content.
if(isset($_GET['page']) && $_GET['page'] > 0){
print $content;
exit();
}

just before

// Special use case for the front page.
if ($is_front) {

 
 

Drupal is a registered trademark of Dries Buytaert.