Next and Previous Links for Views Listing in Drupal

Category
best drupal modules, drupal, modules
Date Created
28th Apr 2010
Last Updated
24th Jan 2011

Next and Previous Links for Views Listing in Drupal

Question

How to implement Next and Previous Links for Views Listing

Answer

Custom Pagers Module

Custom Pagers module allows administrators to define context-sensitive previous/next pagers for any node type. The list of nodes to be cycled through is generated by a user-selectable view, and each pager can be displayed above or below the node body or in a sidebar block. This makes it possible to duplicate the paging functions of forum.module and book.module, as well as more complex stuff like comic strip navigation. Requires token.module and views.module.

http://drupal.org/project/custom_pagers

Note: beta1 version has an error which restricts it to only provide next and previous for the first 10-items. To overcome this within custom_pager.module insert:

Original Code

<?php
// Make sure the query is not cached
$view->is_cacheable = FALSE;
$view->execute();
?>

Updated code to fix error

<?php
// Make sure the query is not cached
$view->is_cacheable = FALSE;
$view->init_display();
$view->pre_execute();
$view->execute();
?>

For more info see: http://drupal.org/node/464734 (item #13).