Download & Extend

fix to loop through nodes so Prev/Next links are always there

Project:Custom Pagers
Version:6.x-1.10-beta1
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:active

Issue Summary

When on the page 1 of 10, I wanted the Previous link to still appear, and send viewers to page 10 of 10, and same (or vice versa) for the Next, on page 10 of 10 to send users back to page 1 of 10.

In case anyone else is interested in this functionality, I changed the code around line 310 that was

  $vars['previous'] = !empty($nav['prev']) ? l(t('‹ previous'), 'node/'. $nav['prev']) : '';
  $vars['key'] = t('@count of @count_total', array('@count' => ($nav['current_index'] + 1), '@count_total' => count($nav['full_list'])));
  $vars['next'] =  !empty($nav['next']) ? l(t('next ›'), 'node/'. $nav['next']) : '';

to

  $vars['previous'] = !empty($nav['prev']) ? l(t('‹ previous'), 'node/'. $nav['prev']) : l(t('‹ previous'), 'node/'. $nav['last']);
  $vars['key'] = t('@count of @count_total', array('@count' => ($nav['current_index'] + 1), '@count_total' => count($nav['full_list'])));
  $vars['next'] =  !empty($nav['next']) ? l(t('next ›'), 'node/'. $nav['next']) : l(t('next ›'), 'node/'. $nav['first']);

and that did it. Seems like a nice thing to have.

Comments

#1

I've started a page of examples for this module: http://drupal.org/node/387786
Perhaps you'd like to add this to it?

#2

thanks for posting this ... very helpful ...

#3

yeah, thats a nice thing to have, would be cool to see a setting for this behaviour in the module!

thanks + best,
walter

nobody click here