Hi,

If one wanted to create a sub theme of Garland (with only slight CSS modifications) and keep all of Garland's coloring capabilities, how should the sub-theme's color.inc file look? Specifically, are the paths used in color.inc relative to the sub-theme, drupal base or the base theme itself?

Looking at Minelli, indicates using a path relative to the sub theme is the correct way. Minelli's color.inc paths are like this:

'../images/some-image.png'

And of course Minelli is a sub-theme of Garland (and conveniently located in a sub folder of Garland). Now, if my sub-theme is site specific in a multisite installation at sites/somesite.com/themes/my_garland then how do I compose my paths? Am I really to use a relative path here like ../../../../themes/garland ?

That doesn't seem right to me. Any help would be appreciated. Thanks!

Comments

mike69’s picture

Hi AltaVida,

I found this thread because I had the same problem. The only way I found was:

  • copy the image folder from garland to the sub-theme (site/all/themes/mysubtheme/...)
  • copy the color folder from garland to the sub-theme (site/all/themes/mysubtheme/...)
  • copy the style.css from garland to the sub-theme (site/all/themes/mysubtheme/...)

All other experiments with relative pathes leave a wrong path for the bg-images. It points to the garland folder. :-(

Ciao,
Mike

mry4n’s picture

I too have the same problem. Of course, the problem with manually copying these files is that you have to recopy them any time there's an update to the Garland theme, right?

Actually using the relative path with all the ../ is the right way to go. Now, I'm just having a problem making the color module work right. Only the bottom half of my page is the correct color. The top half remains the base blue color. Hmmm... still hunting around for an answer to this.

ayduns’s picture

... but I encountered the same symptoms and it turns out to be related to using a theme with a 2-character name. There's a bad regexp that tries to simplify paths containing '..' and puts the wrong image URL's in style.css

HorsePunchKid’s picture

Here's a solution that doesn't involve copying any files and thus is less likely (though perhaps not unlikely) to cause problems during upgrades.

  1. Create your subtheme's directory and info file, themes/my_theme/my_theme.info.
  2. Make sure my_theme.info has base theme = garland.
  3. Inside the my_theme/ directory, make a symlink to [drupal]/themes/garland/color, so that you end up with a "directory" my_theme/color/.
  4. Do the same for images/ and style.css.
  5. If you're doing this in a site's own themes/ directory (e.g. [drupal]/sites/default/themes/my_theme/), make a symlink in the themes/ directory to [drupal]/themes/garland.

At this point, you should be able to enable your theme and use the color picker, and you can proceed to customize your theme.

janieh473’s picture

"Inside the my_theme/ directory, make a symlink to [drupal]/themes/garland/color, so that you end up with a "directory" my_theme/color/."

Dumb question of the day: How exactly do you create a symlink? Is there any way to do this on a shared Linux server? I don't think I have command-line access.

JoshOrndorff’s picture

In linux the link command makes symlinks and is quite easy to use. However if you don't have command line access it might not be so straight forward. If you have cpanel access, look around in there and there might be an option although it is not in my cpanel.

The best bet is to contact your hosting company. They will likely be able to create the link for you, or for a more sustainable option, they may enable ssh for you. If you have ssh access then you can access the command line remotely. I use hostmonster, and they required me to scan my passport before they would enable shh, but it was definitely worth the few minutes it took me to find, scan and email my passort. There have been many times when using the command line has been easier than trying to use ftp.

Good Luck!
-Josh

jjmackow’s picture

Create the links using php, in particular, the symlink($target, $link) function.
I created the following php script and called it linkcolor.php:

$subtheme = "ncos_garland";
$target = $_SERVER["DOCUMENT_ROOT"].'/themes/garland/color';
$link = $_SERVER["DOCUMENT_ROOT"].'/sites/all/themes/'.$subtheme.'/color';
symlink($target, $link);

This script is especially useful with cPanel since you aren't allowed command line access for creating the symlinks.

cheers,

kev