Hi,

I´m unable to theme a custom pager by modifying the title of the original template and placing it in my theme folder. I have tried using the ID of the custom pager and the NODE TYPE to which the pager appears in:

custom-pager-PAGER ID.tpl.php => custom-pager-4.tpl.php
custom-pager-NODE TYPE.tpl.php => custom-pager-blog.tpl.php

after flushing the caches and rebuild the theme registry the changes introduced in the tpl files are not applied and a default custom pager is rendered instead.

I don´t know to what extent this is not working properly or I´m missing something important.
Any help it´s very much appreciated.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

camsoft2000’s picture

Try copying the custom-pager.tpl file from the Custom Pager module and placing it in your theme directory, then rebuild the theme registry.

edulterado’s picture

That´s exactly the way I proceeded.

If I leave the original title of the tamplate file in my theme folder I can override the output of the custom pager module. The thing is that I´m trying to theme specific custom pagers to make them different depending on where they appear: I have at least two different pagers. As you can read in the Documentation of the module, in Drupal 6:

Use a template file in your theme to control the output of your pager.
To theme all pagers, use custom-pager.tpl.php.
To theme pagers more selectively:
custom-pager-PAGER ID.tpl.php
custom-pager-NODE TYPE.tpl.php
custom-pager-PAGER POSITION.tpl.php
custom-pager-NODE TYPE-PAGER POSITION.tpl.php
custom-pager-PAGER ID-PAGER POSITION.tpl.php

But i´m unable to rename the title regarding the PAGER ID or NODE TYPE. The changes are not applied and the default custom pager is rendered (even after flushing all caches and rebuild the theme registry).

camsoft2000’s picture

Your theme folder must contain custom-pager.tpl.php as well as any specifically targeted versions of this file. So if you wanted to have a custom pager for a specific node type say "page" you would need the following files in your theme folder: custom-pager.tpl.php and custom-pager-page.tpl.php

edulterado’s picture

camsoft2000, that´s exactly what I did and I can´t override the custom pager that way: when I put the files custom-pager.tpl.php and custom-pager-NODE TYPE.tpl.php in my theme folder changes are not applied.

Actually, the only thing that works here it´s to place those files in the original folder of the module, which is a non recommended practice.

camsoft2000’s picture

I'm assuming you've cleared the cache and rebuilt the theme registry?

You can use http://drupal.org/project/devel_themer module to debug theme related issues it might help. It will tell you what your valid candidate names for overriding template files are.

edulterado’s picture

Yes, you´re assuming right: I have cleared all the caches and rebuilt theme registry.

The Themer Info didn´t shed new light about the template suggestions: they were the expected ones.

camsoft2000’s picture

Have you tried overriding template files for another module other than custom pager?

mmrtnt’s picture

Was this ever resolved?

I ended up putting my override in the Custom Pager module directory so I could get on with my life... but I would like to follow "best practices" and override it in my theme instead.

Thanks

clmntbk’s picture

Version: 6.x-1.0-beta2 » 7.x-1.x-dev

Hello, I am too unable to override custom-pager-1.tpl.php on D7 version of "Custom Pagers" module...
Tried to add "custom-pager.tpl.php" AND "custom-pager-1.tpl.php" in my theme's templates folder, cleared the cache and theme registry, but still nothing. Putting "custom-pager-1.tpl.php" in the module folder isn't a solution at all! Needs maybe a template.php function to take in consideration the .tpl.php files of the module ?
This module seems powerful: it deserves a little more achievement to be useful on Drupal 7. Meanwhile, I'll use Flippy or Prev/Next which are less customizable but more advanced on D7.

Thank you by advance for your work,
Clément

remydenton’s picture

Category: Support request » Bug report
Issue summary: View changes
Status: Active » Needs review
FileSize
1.23 KB

I ran into the same issue on D7. I believe it's because the theme_hook_suggestions aren't properly formatted.

Attached is a patch that should allow the following templates to work in D7:

custom-pager--[position].tpl.php
custom-pager--[node-type].tpl.php
custom-pager--[node-type]--[position].tpl.php
custom-pager--[pager-id].tpl.php
custom-pager--[pager-id]--[position].tpl.php

For example:
custom-pager--block.tpl.php
custom-pager--news-story.tpl.php
custom-pager--news-story--block.tpl.php
custom-pager--1.tpl.php
custom-pager--1--block.tpl.php

edulterado’s picture

I found a dirty and quick workaround for this a long time ago, I forgot to post the solution here since I dropped Drupal after that. I just implemented custom_preprocess_custom_pager(&$vars) function from my theme and put there array_unshift($vars['theme_hook_suggestions'], 'pager__[NODE-TYPE]');. Then, I was able to theme custom pagers by using the template file pager--[NODE-TYPE].tpl.php.

However, the patch on #10 works great for me. Thank you, remydenton!

westwesterson’s picture

Status: Needs review » Reviewed & tested by the community

works great now, marking RTBC