2

I cannot override views-view-summary-unformatted.tpl.php inside my own theme. I copy the tpl from the views module directory, paste into my theme directory and modify the code. My website will not recognize the new tpl. If I make the changes directly inside the views module, then I can see my changes on my website. However, I know it is not best practice to hack a contributed module. I've tried adding "--myViewName" to the tpl file, but this doesn't help. When I look at the Theme Information in my view, I don't see views-view-summary-unformatted.tpl.php listed there. (The reason I am trying to override this tpl is that I want my alpha bar to include all letters of the alphabet even if there are no entries for a particular letter.) Can someone please help me figure out what I am doing wrong? Thanks!

  • 1
    I know, I know how it sounds, but have you cleared your caches? Especially theme registry? And ahve you clicked "rescan" in view's settings? Copying .tpl.php files from module to your theme is not considered hacking. It is the proper way. And it should work, if you keep the name just as it was. Especially, count - signs, sometimes they are doubled --, and once I even seen them tripled ---. Using wrong number will stop Drupal from recognizing them. – Mołot May 13 '14 at 21:42
  • Thanks for your response. Yes, I did clear the caches and theme registry. Yes, I did rescan, but views-view-summary-unformatted.tpl.php never even showed up as an option at all. And by hacking, I meant if I change the tpl file inside the views directory (because it works there). And yes, I tried keeping the same exact name. Is there anything else I might be missing? – user3511847 May 14 '14 at 13:00
  • Unfortunately no, nothing comes to my mind. It is that irritating case of "works for me", I'm afraid. – Mołot May 14 '14 at 13:09
  • Should I be using a different template to affect the alphabetical menu? Here are my options under theme information. (BTW I am using views 3.7) Display output: views-view.tpl.php, views-view--clone-of-glossary.tpl.php, views-view--default.tpl.php, views-view--default.tpl.php, views-view--attachment.tpl.php, views-view--clone-of-glossary--attachment.tpl.php Style output: views-view-table.tpl.php, views-view-table--clone-of-glossary.tpl.php, views-view-table--default.tpl.php, views-view-table--default.tpl.php, views-view-table--attachment.tpl.php, views-view-table--clone-of-glossary--attachment. – user3511847 May 14 '14 at 15:57
1

I know this is old but today I struggled with this and thought I should provide a solution.

First, you have to rename your copy of 'views-view-summary-unformatted.tpl.php' so views can discover it. It should be named 'views-view-summary-unformatted--my-view.tpl.php'.

You then need to click the 'rescan template files' button under the theme information in the view.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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