Title of node instead of <previous ... next>

RTFVerterra - April 9, 2009 - 04:18
Project:Custom Pagers
Version:6.x-1.x-dev
Component:User interface
Category:feature request
Priority:critical
Assigned:Unassigned
Status:active
Issue tags:custom pagers, module, pagination
Description

Hi, great module and I like it very much. I think it is better if we have an option to display "" into "". The display "" is great for image galleries and the display "" is great for blog and other articles. Just my opinion. Thank you for this module. :)

#1

RTFVerterra - April 9, 2009 - 04:24

Hi I want to retype my request because my < and > turned into html tags. I cannot edit my request, lesson for not previewing it.

What I mean in my request is to have an option to display "<title-of-previous-node # of # title-of-next-node>" and "<previous # of # next>".

"<title-of-previous-node # of # title-of-next-node>" is good for blog.
"<previous # of # next>" is good for images. Thanks again.

#2

jmesam - May 24, 2009 - 18:51

My vote for this

#3

fluidicmethod - July 4, 2009 - 01:59
Priority:normal» critical

Can someone please adapt the 5x solution to this? I really need the titles to be shown, there's no reason, and me personally, that one would click on a random "next previous" button without knowing what they're clicking on. I understand the switch was made for speed but the point is usability otherwise the module is useless.

#4

mrhappymac - July 23, 2009 - 13:56

I agree with fluidicmethod, when can we expect to see this implemented, wasted my time installing it, can you at least mention it on the screenshot link from your project page!! very misleading!!

#5

the2ndday - October 8, 2009 - 18:28

I really want this feather. Anyone?

#6

mcsolas - October 14, 2009 - 18:15

Subscribing.. I see the need for this as well.

#7

krabbe - October 29, 2009 - 01:55

Subscribing .... It's a must have feature, I think.

#8

letrice - November 5, 2009 - 11:24

To output titles instead of prev/next, just modify 5 lines of code in the file custom_pagers/custom_pagers.module.

<?php
function custom_pagers_preprocess_custom_pager(&$vars) {
 
drupal_add_css(drupal_get_path('module', 'custom_pagers') .'/custom_pagers.css');
 
$node = $vars['node'];
 
$pager = $vars['pager'];
 
$nav = $vars['nav_array'];

 
// new lines for the titles
 
$nextTitle = isset($nav['next']) ? check_plain(db_result(db_query('SELECT title FROM {node} WHERE nid = %d',$nav['next']))) : '';
 
$prevTitle = isset($nav['prev']) ? check_plain(db_result(db_query('SELECT title FROM {node} WHERE nid = %d',$nav['prev']))) : '';
 
$vars['previous'] = !empty($nav['prev']) ? l($prevTitle, '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($nextTitle, 'node/'. $nav['next']) : '';

 
// comment out these 3 lines
  // $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']) : '';

 
$vars['suggestions'][] = "custom-pager-{$vars['position']}";
 
$vars['suggestions'][] = "custom-pager-$node->type";
 
$vars['suggestions'][] = "custom-pager-$node->type-{$vars['position']}";
 
$vars['suggestions'][] = "custom-pager-$pager->pid";
 
$vars['suggestions'][] = "custom-pager-$pager->pid-{$vars['position']}";
}
?>

Maybe there is a better solution, but this works fine for me.

The following link contains the modification which is described above, you can see it in action: Junggesellenabschied T-Shirt bedrucken

Hope a feature like this will be in a future release :)

Have fun!

#9

slovak - November 22, 2009 - 06:36

This was addressed in version 6.x-1.x-dev - see http://drupal.org/node/516862 for a self-made patch or use the attached file (had to zip the one file in order to attach it). Works like a charm on my website blog - http://peterpetrik.com/blog

Peter...

AttachmentSize
custom_pagers.module.zip 3.39 KB
 
 

Drupal is a registered trademark of Dries Buytaert.