diff -urp /home/drupal/custom_pagers/custom_pagers.admin.inc custom_pagers/custom_pagers.admin.inc --- /home/drupal/custom_pagers/custom_pagers.admin.inc 2010-01-17 23:57:39.000000000 +0100 +++ custom_pagers/custom_pagers.admin.inc 2010-11-15 07:54:56.000000000 +0100 @@ -47,6 +47,13 @@ function custom_pagers_form(&$form_state '#default_value' => $pid ? $pager->title : '', ); + $form['node_titles']['custom_pagers_display_titles'] = array( + '#type' => 'checkbox', + '#title' => t('Use the node titles for the prev/next pager'), + '#return_value' => 1, + '#description' => t("You can use this switch to change the way the prev/next pager is constructed. Normally it displays the prev/next text, but you might want to use the previous and next node's titles for the link title."), + '#default_value' => $pid ? $pager->custom_pagers_display_titles : NULL + ); $form['position'] = array( '#type' => 'select', diff -urp /home/drupal/custom_pagers/custom_pagers.install custom_pagers/custom_pagers.install --- /home/drupal/custom_pagers/custom_pagers.install 2010-01-17 23:14:21.000000000 +0100 +++ custom_pagers/custom_pagers.install 2010-11-15 07:44:30.000000000 +0100 @@ -77,6 +77,13 @@ function custom_pagers_schema() { 'size' => 'tiny', 'description' => 'A boolean flag indicating that this {custom_pager} should be displayed in reverse order.', ), + 'custom_pagers_display_titles' => array( + 'type' => 'int', + 'not null' => TRUE, + 'default' => 0, + 'size' => 'tiny', + 'description' => 'A boolean flag used to troggle prev/next text or use the node titles in the url.', + ), ), 'primary key' => array('pid'), ); diff -urp /home/drupal/custom_pagers/custom_pagers.module custom_pagers/custom_pagers.module --- /home/drupal/custom_pagers/custom_pagers.module 2010-01-17 23:08:10.000000000 +0100 +++ custom_pagers/custom_pagers.module 2010-11-15 08:12:34.000000000 +0100 @@ -289,6 +289,31 @@ function template_preprocess_custom_page $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']) : ''; + // if people want to use the node titles for the prev/next pager, they now can set an option + if ($pager->custom_pagers_display_titles != 0) { + // load the previous node + $prevnode = node_load($nav['prev']); + // make it look pritty + if (strlen($prevnode->title) < 20) { + $prevtitle = ' « ' . substr(t($prevnode->title),0,20); + } + else + { + $prevtitle = ' « ' . substr(t($prevnode->title),0,20) . '...'; + } + $vars['previous'] = l($prevtitle, 'node/'. $nav['prev']); + // load the next node + $nextnode = node_load($nav['next']); + if (strlen($nextnode->title) < 20) { + $nexttitle = substr(t($nextnode->title),0,20) . ' » '; + } + else + { + $nexttitle = substr(t($nextnode->title),0,20) . '... » '; + } + $vars['next'] = l($nexttitle,'node/'. $nav['next']); + } + $vars['template_files'][] = "custom-pager-{$vars['position']}"; $vars['template_files'][] = "custom-pager-$node->type"; $vars['template_files'][] = "custom-pager-$node->type-{$vars['position']}"; diff -urp /home/drupal/custom_pagers/custom-pager.tpl.php custom_pagers/custom-pager.tpl.php --- /home/drupal/custom_pagers/custom-pager.tpl.php 2008-12-24 01:58:21.000000000 +0100 +++ custom_pagers/custom-pager.tpl.php 2010-11-15 05:14:36.000000000 +0100 @@ -24,7 +24,7 @@ */ ?>