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. :)
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Jhun Vert’s picture

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.

Anonymous’s picture

My vote for this

ericjam’s picture

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.

mrhappymac’s picture

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!!

the2ndday’s picture

I really want this feather. Anyone?

mcsolas’s picture

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

krabbe’s picture

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

letrice’s picture

Issue tags: +module, +pagination, +custom pagers

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

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!

Slovak’s picture

FileSize
3.39 KB

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...

jiakomo’s picture

Nice module, but screenshot was a bit misleading.

Letrice/slovak, could you suggest a solution for the 5.x-1.9 version?

idflorin’s picture

add this in your template.php.tpl

function phptemplate_preprocess_custom_pager(&$vars) {

$nav = $vars['nav_array'];
  $prev = 'prev';
  if (!empty($nav['prev'])) {
    $nodeObj = node_load($nav['prev']);
    if ($nodeObj) {
      $prev = node_page_title($nodeObj);
    }
  }

  $next = 'next';
  if (!empty($nav['next'])) {
    $nodeObj = node_load($nav['next']);
    if ($nodeObj) {
      $next = node_page_title($nodeObj);
    }
  }

$vars['previous'] = !empty($nav['prev']) ? l('‹ ' . $prev, 'node/'. $nav['prev']) : '';
$vars['next'] =  !empty($nav['next']) ? l($next . ' ›', 'node/'. $nav['next']) : '';

}

pribeh’s picture

Has anybody tried the patch from #9 with the latest beta-2?

Marko B’s picture

NUmber 11 works, great!

BeaPower’s picture

none worked for me...

pribeh’s picture

I can confirm #11 worked for me.

BeaPower’s picture

did you past this or replace code in theme folder of drupal site or module?

pribeh’s picture

Put the following in your template.php (make sure to change where it says "theme-name" to your theme's exact name and to not include the <?php ?> tags):

<?php
function THEME-NAME_preprocess_custom_pager(&$vars) {

$nav = $vars['nav_array'];
  $prev = 'prev';
  if (!empty($nav['prev'])) {
    $nodeObj = node_load($nav['prev']);
    if ($nodeObj) {
      $prev = node_page_title($nodeObj);
    }
  }

  $next = 'next';
  if (!empty($nav['next'])) {
    $nodeObj = node_load($nav['next']);
    if ($nodeObj) {
      $next = node_page_title($nodeObj);
    }
  }

$vars['previous'] = !empty($nav['prev']) ? l('‹ ' . $prev, 'node/'. $nav['prev']) : '';
$vars['next'] =  !empty($nav['next']) ? l($next . ' ›', 'node/'. $nav['next']) : '';

}
?>
BeaPower’s picture

No still didnt work for me even if I added my theme name which is something like this - theme_name :/

asb’s picture

I the name of your the was 'Garbund', you would write function garbund_preprocess_custom_pager..., not function theme_garbund_preprocess_custom_pager...

BeaPower’s picture

no my theme is simply_modern that is what I replaced with THEME-NAME

DrippelDrop@drupal.org’s picture

#17 works great, but it is possible to only show the first xx letters of the title? I did it in the views definition, but it didn't work with the code... Any ideas?

Edit: Ok I did it like this:

      $prev = mb_strcut($prev, 0, 40);
      $prev = $prev."...";

and likewise with next.

Hope this is ok, at least it works :)

CJBrew’s picture

#11 works for me, but you will have to replace the "‹" with a real "<" and similarly for the close-angle bracket.

captix’s picture

@11 your code not worked for me

where i put that code?

Rob C’s picture

Issue tags: +node titles
FileSize
3.85 KB

I created this, it's not perfect, but it does give you the option to change this per pager.
This will also patch the tpl.php file, cause this order makes more sense when you enable this feature.
It will present an option at the 'add custom pager' page where you can 'enable' the feature.
Hope it helps. :) (be sure to reinstall the module, else it wont work. i didn't create an update)

Rob C’s picture

Reworked the patch, use this patch, forget the first one.

Changed a lot, so it contains:
- patch against 1.0 beta2
- adds an option to enable the nodetitle on pager functionality on the admin page
- added an option to limit the length of a title on the admin page
- it will change your custom-pager-tpl.php file.

Still wonder if it's smart to use node_load to fetch the title, any suggestions?

Rob C’s picture

And to finish it up for today, the mysql query from #8 added. This should do it.

tebdilikiyafet’s picture

this patch didn't worked for me. it gives parse error. actually I am new to doing patch. is there anyone who successfuly use this patch ?

Rob C’s picture

(ill rework the patch, made a mistake creating it, you have to run it from the modules dir, not inside the custompagers dir. and i changed some other issues, ill post it later next week, got a busy schedule.)

Anonymous’s picture

Patch #26 works for me

benvolio’s picture

Thank you letrice

sean_a’s picture

#8 worked except on node titles that contain quotes in them. I removed check_plain on the first part because l() runs check plain also and it was running the title through twice.

asb’s picture

Priority: Critical » Major

I am using two different pagers and would like to use node titles in custom pager id2, but not in custom pager #1. Is this possible?

I couldn't find a way to create two different functions like function THEME-NAME_preprocess_custom_pager_1 and function THEME-NAME_preprocess_custom_pager_2 in template.php.

Maybe it is possible to move the logic from template.php into a template file like custom-pager-2.tpl.php?

Thanks!

Anonymous’s picture

In Drupal 7, Flippy (http://drupal.org/project/flippy) has a checkbox option for this.

Flippy seems to be the de facto replacement for Custom Pagers.

Re #32: yes, Flippy can do this.

asb’s picture

Nice project, but only for D7 :(