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.
Comment | File | Size | Author |
---|---|---|---|
#10 | custom_pagers-fix_template_suggestions-1049026-10.patch | 1.23 KB | remydenton |
Comments
Comment #1
camsoft2000 CreditAttribution: camsoft2000 commentedTry copying the custom-pager.tpl file from the Custom Pager module and placing it in your theme directory, then rebuild the theme registry.
Comment #2
edulterado CreditAttribution: edulterado commentedThat´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:
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).
Comment #3
camsoft2000 CreditAttribution: camsoft2000 commentedYour 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
andcustom-pager-page.tpl.php
Comment #4
edulterado CreditAttribution: edulterado commentedcamsoft2000, 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
andcustom-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.
Comment #5
camsoft2000 CreditAttribution: camsoft2000 commentedI'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.
Comment #6
edulterado CreditAttribution: edulterado commentedYes, 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.
Comment #7
camsoft2000 CreditAttribution: camsoft2000 commentedHave you tried overriding template files for another module other than custom pager?
Comment #8
mmrtnt CreditAttribution: mmrtnt commentedWas 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
Comment #9
clmntbk CreditAttribution: clmntbk commentedHello, 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
Comment #10
remydenton CreditAttribution: remydenton commentedI 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
Comment #11
edulterado CreditAttribution: edulterado commentedI 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 therearray_unshift($vars['theme_hook_suggestions'], 'pager__[NODE-TYPE]');
. Then, I was able to theme custom pagers by using the template filepager--[NODE-TYPE].tpl.php
.However, the patch on #10 works great for me. Thank you, remydenton!
Comment #12
westwesterson CreditAttribution: westwesterson commentedworks great now, marking RTBC