Hi -
I was unable to implement changes to the page.tpl.php file of a subtheme. Has the process changed with D6? Thought I'd report it just in case it's a bug.
If in fact it's the process that has changed, please change the Component type of this post to Documentation.
Here's the scoop:
Changes made to a page.tpl.php file in the zen/foo folder* are not recognized. When same changes are made to the page.tpl.php file in the zen/zen folder, the changes appear in the zen/foo theme. It was not obvious to me how to change the template.php file in zen/foo (or any other setting) to allow the changes.
How to make this problem occur:
- create a subtheme following instructions in zen readme.txt
-copy page.tpl.php file from the zen/zen folder to the zen/foo folder
-make changes to this tpl file
-view source in browser - changes do not appear
-make same changes to page.tpl.php in the zen/zen folder
-view source in browser - changes now appear
Hope this is useful as a report. I'm happy to attempt to create a solution if someone is willing to give a little guidance.
*note to noobies: zen/foo is an example directory/name for a subtheme (but you know that already, I know).
Comments
Comment #1
djorn commentedI can confirm that I am having this issue on a default Drupal 6 install. page.tpl.php in my custom subtheme folder is being ignored. I also maintain a D5 website, and the override works just fine on that website.
Comment #2
normic commentedI just ran into that issue, too.
I looked around a bit, especcially in the Zen Classic theme, but I cannot find the difference.
I changed the ZenClassic, page.tpl.php and this change is recognised at once - as I expected it in my own subtheme.
I would call this a bug, or at least a difference between README and behaviour.
Comment #3
johnalbinI would consider this critical.
I will definitely have time to look at this the week of April 7. Hopefully I can look at this before that, but no guarantees. Real life has been keeping me from playing with Drupal 6.
Comment #4
annez commentedMy Zen subtheme is seeing my page.tpl.php changes in my Drupal 6 installation. They're in a copy of page.tpl.php in the subtheme folder.
Something to try: did you clear your cache? I had to do that in order for my page.tpl.php changes to be seen.
Comment #5
normic commentedGenerally a good idea, but every caching function is off in my system...and was never turned on so far. I don't think that it's a good idea to use caching while developing a new template.
Comment #6
normic commentedI've done some more research on this issue, cause now changes are recognized at once. I did not change any setting regarding the caching and I even did not clear it.
Before I've read the post from annez, I used a different theme (not zen), so maybe that was the point.
- created another directory /zen/zentest/
- copied everything from /zen/STARTERKIT/ to /zen/zentest/
- renamed the info-file
- copied layout-liquid.css and renamed it
- copied print.css
- copied /zen/zen.css to /zen/zentest/zentest.css
- replaced every occurrence of STARTERKIT with zentest in template.php and theme-settings.php
- went to admin/build/themes and activated it.
- copied page.tpl.php
- changed it
- and it does NOT work!
- went back to admin/themes and switched to Garland
- switched back to zentest...the change is there...made another change...and it works!
So finally it seems to be an internal zencache or something like that.
I'm not sure, but I think at my first try I switched to different Zenthemes, but not to another one.
@all: a workaround could be switching to another Non-Zen-Theme and then back to your subtheme
@JohnAlbin: HTH fixing it finally.
Comment #7
annez commentednormic: I have caching turned off too and yet clear cache still worked for me. Drupal 6 does caching that you can't turn off.
Drupal 6 uses a theme registry that is rebuilt when you use the clear cache button on admin/settings/performance or go to admin/build/themes. It needs to know which functions are overridden. Once it knows that your functions are in your subtheme directory page.tpl.php rather than the main Zen folder it will continue to call those functions even as you change the code. The code itself isn't registered; the functions and where to find them are. So later changes will be seen as long as no new override templates/functions are added.
Switching from one theme to another rebuilds the theme registry because the theme registry is rebuilt when you visit admin/build/themes.
This is just default D6 behavior as far as I can see, not a bug or secret cache in Zen.
From Converting 5.2 themes to 6.x:
Comment #8
johnalbinAnne is correct. I had forgotten about the theme registry. I’m sure this will bite many, many theme developers.
Just to reiterate… every time you make a change to a .tpl.php page, you need to go to admin/build/themes in order to re-build Drupal’s theme registry cache.
Perhaps, there should be a setting that says something like “Themes are actively being developed, auto re-build the theme registry on every page load. Production sites must disable this option.” Ideally, that setting should be on the admin/settings/performance and/or the admin/build/themes pages, but Zen would only be able to put it on its theme settings page.
Comment #9
normic commentedOuch, this gets me an RTFM ;)
I've never read the "Converting 5.2 themes to 6.x" cause I started this new site with Zen from scratch, so there was no need for converting...
Thank you both for assistance and explanation.
Comment #10
johnalbinWhat I said earlier was slightly off. The definitive way to clear the theme registry is documented here: http://drupal.org/node/173880#theme-registry
Comment #11
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.