0

I have come across something I've never seen before. I'm having trouble understanding the bug, much less clearly explaining it in a question, so bear with me.

I have a theme that is actually a sub theme of Zen. In my themes folder, I have the folders zen and news_center, which is the name of the theme based on Zen, and gotoniseko, which is also based off zen.

This has worked for over a year with no problem. Now, we wanted to create a new theme based off news_center. It's exactly the same theme, except css was changed. You can view the differences here:

http://seesapporo.com <-- original news center theme

http://goniseko.com <-- new theme based off news_center

This is the same Drupal install, but the Domains module is being used for the multi site capability.

So, again, we wanted to create a new theme for the goniseko.com domain. We did, and we uploaded it. Drupal sees the theme fine, and we enable it.

In the new theme, in addition to the CSS changes, we changed html.tpl.php. We added some custom javascript and two static image links.

Here is the HTML that's included in the html.tpl.php file:

<div id="maximage">
<img src="http://gotoniseko.hokkaidoharmony.com/sites/all/themes/gotoniseko/images/summer_1.jpg" alt="" width="1600" height="1200" class="maximage" />
<img src="http://gotoniseko.hokkaidoharmony.com/sites/all/themes/gotoniseko/images/summer_2.jpg" alt="" width="1600" height="1200" class="maximage" />
</div>

Here is the HTML that was actually rendered in the HTML source:

<div id="maximage">
<img src="http://gotoniseko.hokkaidoharmony.com/sites/all/themes/news_center/images/summer_1.jpg" alt="" width="1600" height="1200" class="maximage" />
<img src="http://gotoniseko.hokkaidoharmony.com/sites/all/themes/news_center/images/summer_2.jpg" alt="" width="1600" height="1200" class="maximage" />
</div>

I know for sure when I edit html.tpl.php I am editing the correct file because if I delete it, the theme breaks. But, if the file is there, no changes I make to the file show up. It's almost like there is a cached version taking precedence, but no amount of clearing cache helps.

Ok, in an attempt to debug the problem I changed the name of the new theme's folder from gotoniseko to gotonisekom - bingo! all of my file changes were recognized. So I thought, ok fine, I'll change the folder name and references of gotoniseko to gotonisekom. I did, and I upload the files.

After uploading Here is the HTML that's included in the html.tpl.php file:

<div id="maximage">
<img src="http://gotoniseko.hokkaidoharmony.com/sites/all/themes/gotonisekom/images/summer_1.jpg" alt="" width="1600" height="1200" class="maximage" />
<img src="http://gotoniseko.hokkaidoharmony.com/sites/all/themes/gotonisekom/images/summer_2.jpg" alt="" width="1600" height="1200" class="maximage" />
</div>

Here is the HTML that was actually rendered in the HTML source:

<div id="maximage">
<img src="http://gotoniseko.hokkaidoharmony.com/sites/all/themes/gotoniseko/images/summer_1.jpg" alt="" width="1600" height="1200" class="maximage" />
<img src="http://gotoniseko.hokkaidoharmony.com/sites/all/themes/gotoniseko/images/summer_2.jpg" alt="" width="1600" height="1200" class="maximage" />
</div>

Now I have to have the theme uploaded twice to the theme directory, exact copies of each other (except the .info file), so they cross reference each other and it works ok. Of course this is a hack.

Something is overwriting the theme directory name in static links to be the directory name of the theme that was installed just before it. I know that the way to implement the links and JQuery in the html.tpl.php is not the Drupal way to do it, but this is proof of concept before we invest the time into a real module. However, even if I delete the background image functionality, something still overwrites directory names. What could be causing this to happen?

  • 1
    Any chance you've got some custom code in your theme for rewriting links? Maybe based on a development version of the site being in a subfolder of the webroot, or something like that? – Clive Aug 1 '13 at 8:43
  • Try to "View source code", instead of "Inspect Element" on the page rendered to view the source before any JS has been applied to it. If that source is indeed correct, it's some kind of Javascript that's affecting the results. If it's still incorrect, check if you're altering the correct tpl file or if any theme function is overriding the markup in some way. Also possible is that you need to clear your theme cache... – mariomc Aug 1 '13 at 9:23
  • what could cause whatever changes I make to the file to not render? For example - I just deleted the html in the html.tpl.php file - all of it!! It's a blank file! and yet the html still renders. But get this - if I delete the file, the theme breaks. I have checked that I could be referencing another file but even Devel Themer says it's the correct file and path. Cache was cleared several times. – blue928 Aug 1 '13 at 10:03
  • mariomc I turned JS off. The file still shows the errors. I will say this though after a an hour of just letting is sit, I refreshed, and now half the links are showing correctly and another half are not. This smells strongly like a caching issue. I turned off all caching, I turned off memcache, I've disabled javascript.. I'm at a loss.. I can edit any of these template files and the changes will not show up in the rendered source of the page, no matter what, even with all caching off. – blue928 Aug 1 '13 at 11:05
  • Progress!!!! Can you believe it? I restarted apache and it started to work. I have APC enabled. Could this really be an APC issue? will test more. These are inside php scripts. does apache have its own caching system? would apc cache the entire file where php is found? – blue928 Aug 1 '13 at 11:40

Your Answer

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

Browse other questions tagged or ask your own question.