Full fledged subthemes

We encourage users to post events happening in the community to the community events group on https://www.drupal.org.
jjeff's picture

Don't know if everyone is aware of this yet, but I've recently committed some changes that allow Zen subthemes to have their own node.tpl.php, node-type.tpl.php, page-path.tpl.php, comment.tpl.php block.tpl.php, etc... Subthemes can also now have their own template.php files!!!

This means that you could create a subtheme that is primarily CSS based, but also modifies the way that comments are displayed, or overrides some theme functions.

This can obviously be very powerful, but I am a little nervous about the theme starting to get complicated. Perhaps I could move the (nasty techie) code that handles this stuff into an .inc file or something.

Also of note is that subthemes cannot have their own page.tpl.php files -- because then they will be recognized as a theme of their own. I really like this idea of cascading themes though... It makes me think that themes should use .info files in the same way that modules do -- allowing subthemes to be located anywhere in the themes directory and not requiring them to be actually in a subdirectory of their parent. This way there would be a clean upgrade path for the Zen theme without having to worry about accidentally blowing away your subtheme directory.

Comments

Dev branch

jjeff's picture

This stuff is all in the development version of the Drupal-5 branch. I'm hoping we can get a few other bugs in the queue worked out before I create a new release.

-= Jeff Robbins | Lullabot | Drupalize.me =-

Complexity / The IE6 Question

BryanSD's picture

This can obviously be very powerful, but I am a little nervous about the theme starting to get complicated. Perhaps I could move the (nasty techie) code that handles this stuff into an .inc file or something.

I too am a little nervous about the complexity of the code. Though, I've felt a more "open door" policy for adding subthemes in the CVS is necessary and something Zen seems to want to accomplish.

Actually what concerns me most is how to handle the CSS bugs in browsers (mainly IE6). Should those fixes actually be included in the baseline theme if we're really trying to build a "standards-compliant" browser or would they be better off as part of a sub-theme? While the IE fixes in the theme are nice to have, I'm wondering if it's such a good idea for the theme in the long run? Just thinking as I've been royally frustrated with some IE6 bugs on my page using Zen with the use of View/Panels. More on that later...

BryanSD
CMS Report

Bryan Ruby
socPub

At this point you're only a

merlinofchaos's picture

At this point you're only a couple steps away from being a theme engine...

I agree

Egon Bianchet's picture

Also, if Zen (and Sympal too) were engines, wouldn't it be much simpler to ship and deploy subthemes?

This is a pretty cool

zirafa's picture

This is a pretty cool feature, but IMO something that should get pushed down into the theme engine. From a themer's point of view, Zen is good because it is simple and well organized while providing some examples of theme overrides etc...

There is something kind of elegant about having one consistent XHTML framework and then using only CSS to change the layout and style for various subthemes. At some point if you have a subtheme with its own tpl.php files and template.php I would wonder if maybe that should be started as a separate theme, which is easy enough to do by copying the theme into a new directory.

So I'd say +1 for getting this functionality into the phptemplate engine, -1 for including it in the zen theme itself.