I'm trying to understand drupal's theming system and I thought I was doing quite well when, all of a sudden, I tried to create a custom template for the mini pager of the views module. I'm struggling to understand the right naming convention for the file, altough I've read alot during the past two days.

Here is what I've done: Test template name: myzen

  • overridden the function myzen_views_mini_pager in my template.php This works like a charm, the debugger hits the bps, if any.

  • I tried to inspect the "Theme information" in the advanced section of the view edit page but I failed to see something related to the mini pager.

  • I tried to follow this tutorial and I used the dprint trick to list the possible options and I found this: Array ( [0] => views_mini_pager__evento_view__block 1 => views_mini_pager__block [2] => views_mini_pager__default [3] => views_mini_pager__default [4] => views_mini_pager__evento_view [5] => views_mini_pager )

  • according to the tut and to what I found I tried to guess the template name, which should be: views-view-mini-pager--evento-view--block.tpl.php but this, obviously, fails. I tried like hundred of other combination (removing the block part, changing the - with _, using only pager instead of mini-pager etcetcetc) and nothing worked.

  • fun fact is that I can actually make a template for views-view--evento-view.tpl.php (which override the whole view, of course).

Can you help me in figuring out the right naming convention for the mini pager template in that specific block only?

Thank you!

2 Answers 2


After having Inspected the code more carefully and having read the whole resources I found again I finally found out the I bumped in one nasty corner case.

First of all, reading the code for the views module I found out that the tut I posted in my question was wrong and that the right naming convention for the template file is: views-mini-pager--evento-view.tpl.php (where evento-view is the name of the view).

Then I wanted to try and write a function template (instead of using the .tpl.php file) and I struggled again in finding the right naming convention. Since the views_mini_pager return with theme('item-list', ...) I tried to hook that for my specific view without any luck (mytheme_item_list would work, but changes the html output for every object using the 'item_list'). I finally read more carefully Using the theme layer (Drupal 7.x) especially this:

Drupal provides a few helpers to build complex HTML constructs easily. These are very useful features, and by using them it is easy to create a consistent look on tables and lists. The downside is that they are not readily accessible to a themer. Instead, they place code that should be at the presentation layer into the logic layer, and only advanced themers are able to do anything with it. These functions are more acceptable for administration pages. When creating output that is likely to be changed, it is best to avoid the use of these constructs and create the tables and lists with real HTML code. The forum themes are perfect examples of how to accomplish this and still create HTML code that is consistent. Function name suggestions with double underscores An even bigger problem with using common provided theme functions such as theme('item_list') is that a theme probably does not want to override every theme_item_list() for every list output by Drupal anywhere, but only the one in our module. Therefore, instead of simply theme('item_list'), we can use theme('item_list_mymodule_main', $items) which would make it possible for a theme to implement themename_item_list_mymodule_main() or themename_item_list__mymodule() to override item_list() only for that specific instance.

So I made the mytheme_views_mini_pager function in my template.php returning a theme('item_list__views_mini_pager') hook this with mytheme_item_list__views_mini_pager and all worked like a charm


The theme developer is a very handy module when it comes to find the right theme method and template names. You can just point and click on the gui to get all possible names.

  • Thank you for you answered. I tried with this module without any luck either. Can you argumente more? Thanks again.
    – Geeo
    Commented Jul 13, 2012 at 19:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.