I needed to modify a module's .tpl file and so copied it, renamed it to something suggested by Theme Debug's file suggestions.

Eg when I run `drush theme_debug` I see:

<!-- FILE NAME SUGGESTIONS:
   * image-resp-item--f6.tpl.php
   x image-resp-item.tpl.php
-->

So I rename my new file `image-resp-item--f6.tpl.php` and place it in my site's theme.

I clear cache and rebuild the theme registry but to no affect - the site still uses the original .tpl.

To experiment, I changed my new .tpl's name to match the old one (removed --f6). This works - I see my new code appear on the site.

Why is my site (or theme?) not wanting to use the suggested file name (seems to be fine with all other file name suggestions for other .tpls)?

Comments

CatsFromStonehenge’s picture

Hi

I read somewhere that sometimes clearing the cache via drush, isn't as effective as doing it from the admin dashboard. If in doubt clear the cache there to double check it's definitely not a caching issue.

VM’s picture

I've never read that drush is less effective than admin/performance.
I'd venture that if the above is true, one could then also argue that clearing via the admin dashboard isn't as effective as entering the database and emptying the tables directly to insure they are empty.

CatsFromStonehenge’s picture

I was just saying that when in doubt use two methods to do something (this is good practise in general!). i.e. if both work, then everything is OK. If neither work, that's interesting, if only one works that is also interesting.

Check out this post:

https://drupal.stackexchange.com/questions/74448/drush-cc-all-flush-all-...

Clearing cache via the UI and via drush both end up calling drupal_flush_all_caches(), but there is a subtle difference.

When you run from the UI, the PHP executes as Apache (or however you have your webserver configured). When you run from drush, it runs as the user who executed the command.

So, yes, in theory drush is great for clearing the cache but the problem is when something odd is happening, we should try the more than one method.

VM’s picture

interesting. First I've ever seen anything like that stated.

To other users who find this or are in any way concerned, open your database use both methods and check the cache tables. If there is a difference in your environment, I'd venture the cache tables won't fully be emptied and the remaining rows will contain the stale cache causing the issue.

CatsFromStonehenge’s picture

Yes, I was also surprised. If I hadn't seen that post, I wouldn't have realised.

I think it's a reminder that every Drupal issue, is a huge opportunity for us all to learn more about Drupal's config or it's inner workings. I've learned more by (accidentally) doing things wrong, than by flukily getting them right! :-) This is why a good community support forum like this is also essential. People have saved me many times on here.

Jlols’s picture

Yes, I've cleared the cache with drush (cc all), but for some reason drush wont let me use rr.

CatsFromStonehenge’s picture

Have you double-checked the documentation on this? (I haven't used template suggestions yet, however there might be some clues).
https://www.drupal.org/docs/7/theming/overriding-themable-output/working-with-template-suggestions