Sub-themes, their structure and inheritance
Sub-themes are just like any other theme, with one difference: They inherit the parent theme's resources. There are no limits on the chaining capabilities connecting sub-themes to their parents. A sub-theme can be a child of another sub-theme, and it can be branched and organized however you see fit. This is what gives sub-themes great potential.

Imagine starting with a base theme designed as wireframes, then applying and refining all the details from a sub-theme. Then, off the same wireframe, testing out alternate designs by branching out another sub-theme. Working on a multi-site installation but you need a cohesive look and feel? With sub-theming, a lot of the design resources can be shared. Site-specific changes can be set to a specific sub-theme, but any shared resources can be edited once to be applied across all the installations. With careful planning, the possibilities are endless.
To declare a parent or "base theme", set this inside the sub-theme's .info file," themeName" being the internal name of the parent theme:
base theme = themeName
The following are inherited:
- All style sheets defined in the parent theme, but there is an option so this can be controlled. Furthermore, your subtheme *must* define at least one stylesheet in order to inherit parent stylesheets.
- All JavaScripts defined in the parent theme.
- All template (.tpl.php) files.
- Anything defined from the "template.php" file. This includes theme function overrides, preprocessors or anything else. Each sub-theme will include its own template.php file along with the one provided by its parent.
- Screen shot for the parent theme as long as the .info file uses the same settings from its parent.
The following are not inherited:
- logo.png set for the theme. This does not include uploaded logos, since they will always be used.
- Some of the settings set within the .info file. This includes regions. If you are not using the default regions, then make sure your "page.tpl.php" file for the sub-theme matches what is set for regions in the .info file. Each base and sub-theme can have their own region settings.
- Anything set within the "theme-settings.php" file for the advanced theme settings.
- Anything set within the "color" directory for color.module support.
Note that sub-themes can be placed either inside or outside of the base theme's directory. Prior to Drupal 6, they had to be in a sub-directory of the parent theme.

themeName
What I experienced is: the themeName is the name of the .info file. It seams to me that the name assigned int he "name = [name]" clause cannot be used as a reference for the base theme, but it appears in the administrators page for activating the theme. On the other hand in the users profile the name of the .info file is displayed.
So it seams a good idea to have the same name in both places, but if you don't it may be somewhat confusing.
I would recommend to change this in Drupal and use one name in all places.
sigi reimann
Separate names are good
Having two names for the same theme can make it slightly more confusing for theme developers. However, there's a good reason for it. Drupal uses two names for one theme to make it less confusing for the end users by making it possible to use spaces (and other user friendly characters) in the theme administration pages.
Suppose I have a theme named "Corporate Chic". Because Drupal uses the internal name of the theme as a variable name, it has to conform to the PHP variable naming conventions, which prohibit spaces and most punctuation. We'd have to use either "CorporateChic" or "Corporate_Chic" as the theme name. The first is hard to read, and the second is ugly. Neither one will look good in the themes administration page. But prior to Drupal 6.x, that's exactly how the theme names appeared to the end user - either with no spaces, or with underscores taking the place of spaces.
A somewhat larger issue has to do with internationalization. PHP variable names are limited to ASCII characters (from 127-255 in the ASCII table). If you're writing a theme for use in a Finnish web site, for example, you'll need to change "Väestö" to "Vaesto", which makes it less familiar to Finnish readers and may change its meaning. In German, what do you do about the eszett character? (That's the ß character.) And heaven forbid that you ever try writing a theme in Japanese, Chinese, or any other language written with ideographs.
Splitting the theme name in two lets us get around all that. The INTERNAL theme name (derived from the file name of the info file, e.g. corporate_chic.info) can follow the PHP variable guidelines, whereas the EXTERNAL name of the theme can include spaces, punctuation, and non-English characters. The internal name gets used in Drupal's execution; the external name just serves as the label that the Drupal administrator sees in the administration pages.
So yes, the split makes it slightly more confusing for developers making sub-themes. On the other hand, developers will figure out the difference, and there are many fewer developers than there are end users. It's a good trade-off, and considerate to the end users.
entities have to be used
Remembering your example "Väestö", I used the german Umlaut "ü" in the "description = " part of my .info file. Drupal didn't like it. Allow me to point out, that I have to use the entity ü for this character in the .info file.
Mike
Then it seems to me that the
Then it seems to me that the obvious solution would be for the .info file to contain two configuration settings.
1. Internal Name: The name used internally by Drupal to refer to the theme and which must conform to any PHP naming and character code restrictions.
2. Display Name: The name Drupal uses to reference the theme when communicating with end users.
Having a configuration file where most of the configuration comes from the file's contents, while some of the configuration is derived from a part of the configuration file's own name seems unnecessarily ambiguous.
Color module in Sub-themes
It is worth noting for newbies, that if you want the Color module to operate in a sub-theme, you have to copy not just the color directory, but also:
* The image directory (or wherever the theme keeps all the bits and pieces to be recoloured.
* The style.css file. If you don't copy this, the recolouring all seems to work fine, but it then picks up the default copy of this file, and then by implication the default copies of all the graphics, and nothing in the end happens.
I experience the same
I experience the same behavior ! Some informations of the problem seem to be here :#281489: Sub Themes do not inherit CSS and images
Regions in sub-themes
If you have defined non-standard regions (something other than left, right, content, header and footer) in your base theme and you want those regions in your sub-theme, then don't forget to add them to the sub-theme's info file.
Style sheets defined in parent theme not inherited by default
Contrary to the implication on this page, if you create a sub-theme info file that does not reference any style sheets, style.css in the parent theme is not inherited; see issue #335106: sub-theme doesn't import parent's css.
If you create a sub-theme info file that does reference a style sheet with a different name to the stylesheet in the parent theme, i.e. by adding a line like this:
stylesheets[all][] = my-subtheme-style.cssIf you create a sub-theme info file that references a style sheet with the same name as the stylesheet in the parent theme, i.e. by adding a line like this:
stylesheets[all][] = style.cssstyle.css of the parent theme is overridden.
Note
This does not seem to work in Drupal 6.11. Just tried it, cleared cache, and still not getting a sub-theme to work properly with a defined fake.css that doesn't exist.
Creating template files in a sub theme..
I am trying to create custom template files in my sub theme to handle specific content types.
My base theme is marinelli-6.x-2.9 and my new content type is named event..
My sub theme is configured as a sibling (outside) directory of my base theme.
When I create a file named node-event.tpl.php it has no effect....
I have found that if I move my custom node-event.tpl.php to the base theme directory it works fine and is inherited in my sub theme..
it is just never picked up when it is in my sub theme directory..
I was doing this previously by specifying custom templates for my views i.e. I have a view
called news and I can specify views-view-row-node--news--page.tpl.php as my custom template in my
sub theme dir, and once I rescan the templates it is automatically picked up...
I think this is a bug, so previously created an Issue here http://drupal.org/node/405770
Thank you
John G
have you copied the
have you copied the node.tpl.php file from the parent directory to the the sub-theme's? (or created your own node.tpl.php)
http://www.geoffgolder.com/
http://www.911insidejobshirt.com/
My Sub Theme has a page.tpl.php but no node.tpl.php
The base theme has a node.tpl.php and a page.tpl.php, I copied the page.tpl.php to
my sub theme but not the node.tpl.php.. My modifications to page.tpl.php work as
expected. My sub theme does not have a default node.tpl.php file.
I copied the base theme's node.tpl.php to my sub theme directory, with the name
node-event.tpl.php.. but my modified file was not being picked up.. as a test, I
moved node-event.tpl.php into my base theme, once I did my changes were apparent.
-John G
I had the same problem... resolved..
Please see my comment at http://drupal.org/node/405770
Pixture Reloaded Sub Theme
I'm trying to create a sub them of Pixture reloaded so that I can add a table style.
I created a folder in the themes folder called pixture_reloaded_sub. In it, I have following files:
logo.png
pixture_reloaded_sub.info
substyles.css
pixture_reloaded_sub.info has the following code:
name = Pixture Reloaded Sub
base theme = pixture_reloaded
description = Pixture Reloaded sub theme
core = 6.x
engine = phptemplate
stylesheets[all][] = substyle.css
substyles.css has the following code:
table.budget {
border-width: 1px 1px 1px 1px;
border-spacing: 0px;
border-style: outset outset outset outset;
border-color: black black black black;
}
table.budget th {
border-width: 1px 1px 1px 1px;
padding: 5px 5px 5px 5px;
border-style: inset inset inset inset;
border-color: black black black black;
-moz-border-radius: 0px 0px 0px 0px;
background-color: #9bc068;
text-align: center;
}
table.budget td {
border-width: 1px 1px 1px 1px;
padding: 5px 5px 5px 5px;
border-style: inset inset inset inset;
border-color: black black black black;
-moz-border-radius: 0px 0px 0px 0px;
background-color: #e1ecd1;
}
I see the sub style on the themes page and have enabled it. However, the table style isn't getting incorporated. I have to paste the style code directly into the page with the table in order for it to take effect. Am I missing a file in the sub-theme directory or something coded incorrectly?
If you change the parentage
If you change the parentage of a theme, you can get errors or a blank page due to a glitch in the way things are picked up -- the subtheme picks up that it has a new parent, but still looks at the old tpl files.
The way to get round this is:
1. visit admin themes page
2. edit theme info file to change parent
3. save configuration at the themes page.
Try the Devel module for that
You need to clear the cache to make Drupal re-scan the themes when you do something like altering a sub-theme's parent, add a new .tpl.php file, and so on. Try using the Devel module. It creates a block containing a very handy "empty cache" link for those kinds of situations. And of course it's invaluable for theming in general. Here's a screen cast demonstrating the Devel module.
inheritance question
I have a theme: "children" that inherit from zen, i defined also another subtheme: "grandchildren" that has as parent the children theme.
according to zen in the children_theme function i should call the zen_theme in order to inherit the hooks that zen implements and also in grandchildren_theme function i called the children_theme to keep the same flow.
Right know im having the problem that when i implemented a hook in children i'm not inheriting it in grandchildren, example:
In children_theme i returned in the arrays of hooks the 'uc_catalog_browse' and then declared the function children_us_catalog_browse.
When im using the grandchildren theme im getting the error:
warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, 'grandchildren_uc_catalog_browse'
According to the theme inheritance it should be calling children_us_catalog_browse instead of grandchildren_uc_catalog_browse????
thank you
Breadcrumbs not showing in sub sub-theme
Hi - I'm hoping to get some help here. I have a Zen subtheme "ets", from which I've created several sub-subthemes, one named "classrooms" (so "classrooms" is really a subtheme of "ets", which is a subtheme of "zen"). This is all working very well, except for breadcrumbs. The breadcrumbs show in the "ets" subtheme, but not in any of my sub-subthemes. Can someone tell me how to do this?
Below is the .info file of one of my sub-subthemes, in case that would be helpful:
name = Classroomsdescription = Classroooms subtheme
core = 6.x
base theme = ets
stylesheets[all][] = classrooms.css
regions[left] = left sidebar
regions[right] = right sidebar
regions[navbar] = navigation bar
regions[content_top] = content top
regions[content_bottom] = content bottom
regions[header] = header
regions[footer] = footer
regions[closure_region] = closure