"Rescan template files" button

mooffie - June 16, 2008 - 06:57
Project:Views
Version:6.x-2.x-dev
Component:User interface
Category:feature request
Priority:normal
Assigned:Unassigned
Status:closed
Description

The help says that by visiting 'administer >> site building >> themes' it's possible to clear the theme cache. This isn't true, at least not on my system: merely visiting that page doesn't call drupal_rebuild_theme_registry() (it's hitting 'Submit' that does).

This patch makes it easier for themers by adding a "Rescan template files" button to the "Theme: Information" section.

I'm attaching a screenshot and a patch.

AttachmentSize
rescan_templates.png57.46 KB

#1

mooffie - June 16, 2008 - 06:59

...and the patch.

AttachmentSize
rescan_templates.diff3.08 KB

#2

mooffie - June 16, 2008 - 07:02

(I know that in Drupal's lingo the common expression is "clear theme's cache" or "clear the theme registry", but I think that the term "rescan" is easier to understand.)

#3

merlinofchaos - June 23, 2008 - 20:59
Status:patch (code needs review)» fixed

Committed! Thanks for the patch!

#4

mooffie - June 24, 2008 - 16:23

Thanks for committing it, I believe it's a valuale feature.

Note, however, that I've found an elusive bug with this button, and published a patch. Sorry for the bother.

#5

Anonymous (not verified) - July 8, 2008 - 16:24
Status:fixed» closed

Automatically closed -- issue fixed for two weeks with no activity.

#6

heather - July 20, 2008 - 20:56
Status:closed» active

I'm really glad you put this button *somewhere*... because i was getting really frustrated not knowing why my templates were not working... I clicked this button, and was relieved to see that I was not, in fact, crazy.

Now... my only issue is that is it hidden, and hard to find - considering how essential it seems to be. Also even the "important" notice is in grey. This would be a great button to just put all over the place, or mention it everywhere. Not sure where else would be a good place... while looking for a solution to my problem, I tried several places over the course of 3 hours...
- I looked on Drupal.org, google (but didn't know what was wrong so this didn't help)
- I looked on the views list page for some indication of "oh you made some templates, and they're not apparently working? click here- all your problems solved.
- I also looked in the readme.txt of views
- and I looked on the editing screen of the view itself... many many times... before even noticing the "Theme Information" options... and even then, I didn't see the great little button for several tries, messing around with the different options and theme examples...

I have advanced help installed, but nothing came up.

OR... how about an additional THEME-README.txt file? with something like:

Tips on creating templates for your views:

In "Edit view" page, under Basic Settings, select Theme: Information.

Theming information lists all possible templates for displaying your theme. You can use the file names there as a guide to naming your theme templates.

Important: When you create a new template you need to "Rescan template files" for changes to be reflected.

Scroll down on Theme: Information and click "Rescan template files" button

#7

merlinofchaos - July 21, 2008 - 02:04

heather: Here is the awesomest part.

I've already done almost precisely what you ask. Check this out.

There's a help topic entitled Using Views templates.

This topic lists the most important things you need to know about templates. Including:

2. Clear the theme registry. See the instructions for how to do this.

This links to http://drupal.org/node/173880#theme-registry

It also includes pretty much all the other information you suggest, and more.

#8

merlinofchaos - July 21, 2008 - 02:04
Status:active» fixed

#9

heather - July 21, 2008 - 08:23

wo0t!! i see it now :)

the thing is, anubi like me, i didn't know what my problem was... so although i went to the handbook... i didn't see the solution. and of course, just installing advanced help, this mention didn't appear to me when i needed it.

i'd still be in favor of mentioning this fact on the views list page, in context, just like the modules page points out:

It is important that update.php is run every time a module is updated to a newer version.

something like:

Remember to clear the theme registry when adding or removing theme functions and templates.

#10

Anonymous (not verified) - August 4, 2008 - 08:32
Status:fixed» closed

Automatically closed -- issue fixed for two weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.