For various reasons, I've decided that I want to use the phptemplate theme and have it twice for a site I'm working on. I copied and renamed the folder to blog_template and replaced all occurances of 'phptemplate' with 'blog_template'. This resulted in a function [?function _blog_template_get_settings()?]. Now, no matter which theme is set as default, both the above function and [?function _phptemplate_get_settings()?] get called. I had expected that only the one which corresponds to the selected theme would get called. Can anyone explain what is going wrong? Thanks!

Comments

robertDouglass’s picture

I hate having to spell English

- Robert Douglass

-----
visit me at www.robshouse.net

robertDouglass’s picture

It is because both phptemplate.theme and blog_template.theme get included and these methods get called every time they are included. But this doesn't make sense, as the theme.inc init_theme() function is supposed to include only the .theme file which is actually being used. Where does the other one get included?

- Robert Douglass

-----
visit me at www.robshouse.net

robertDouglass’s picture

A little background as to why I would attempt to do this would probably help. I'm making a site where users entering the site through the main domain experience it with the normal theme that I set up. When entering the site through a subdomain, however, eg. name.site.com, I lookup name in the users table and redirect to his or her blog and theme it with the theme of that user's choice, so every user has not only a personal blog, but a whole blog site of their own. This is, of course, how blogspot.com works. To achieve all themes with phptemplate, I thought it would be best to have the main site theme in one phptemplate folder, and all of the themes available to users in another. That's how I've run into the problem described above.

- Robert Douglass

-----
visit me at www.robshouse.net

robertDouglass’s picture

I now see that all .theme files get included in the system.module. Turns out, I have to rename all instances of '$template_name' to '$blog_template_name' in the blog_template theme. All other variables have the prefix phptemplate_ or blog_template_. Only template_name didn't, thus the conflict.

- Robert Douglass

-----
visit me at www.robshouse.net

Dublin Drupaller’s picture

Hi Robert.

Read your post and thought I might mention the following patch for allowing different themes using the same database.

I think it maybe useful for what you are trying to achieve.

http://drupal.org/node/view/5942

Anyway. best of luck. hope it helps

Jason

Currently in Switzerland working as an Application Developer with UBS Investment Bank...using Drupal 7 and lots of swiss chocolate

robertDouglass’s picture

I hadn't seen that, thanks.

- Robert Douglass

-----
visit me at www.robshouse.net

adrian’s picture

I wrote phptemplate, and I have much the same use for it than you do.

I just havent release my blogger.com alike functionality for oasismag.com due to server issues, but I will do so in the future

Using the overriding functionality (as described in the INSTALL file) , you can set the tempate to be anything you please. Then make a special selector for templates that you make available to your user.

You can successfully switch the template anytime before the theme is actually loaded

The correct way to do this is with stylesheet switching in any case. You should only change the actual markup generated if there is No Other Way

  Sanity is a sandbox in the playground of my mind.
     I'm going to go play on the swings now.
robertDouglass’s picture

I'll take another look at it and see if there isn't Another Way than what I've been considering. By the way, I'd been meaning to thank you for documenting phptemplate so well. It makes it so easy to use.

- Robert Douglass

-----
visit me at www.robshouse.net