CSS aggregation in D6

halver - May 28, 2009 - 15:32
Project:Zen
Version:6.x-1.0
Component:PHP Code
Category:support request
Priority:normal
Assigned:Unassigned
Status:active
Description

I am having problems with IE not reading some of the stylesheets in my subtheme, presumably because IE is limited to 31 stylesheets. I'd like to solve this through CSS aggregation. However, CSS aggregation using site>performance is not possible when using private download method, as I am.
I found another post about using the theme to do the aggregation here: http://drupal.org/node/254780. However, this is for d5, not d6. I tried implementing it and first got a fatal error because it called a function path_to_subtheme that no longer exists in d6. I changed it to path_to_theme as suggested here: http://drupal.org/node/260665.
Now no stylesheets are being loaded at all.
Does anyone have any advice on how to implement this method with d6?
Thanks very much.

#1

Onopoc - July 1, 2009 - 20:48

The function has indeed change for Drupal 6: http://drupal.org/node/222934#comment-1765580

With Drupal 6 use one of the 2 following:

<?php print base_path() . path_to_theme() .'/' ?>images/whatever.jpg

<?php print base_path() . $directory .'/' ?>images/whatever.jpg

For example to create a link to your stylesheet located inside your theme or sub-theme directory:

<link href="<?php print base_path() . path_to_theme() .'/' ?>foldernamehere/yourstylesheetnamehere.css" type="text/css" rel="stylesheet">

or
<link href="<?php print base_path() . path_to_theme() .'/' ?>yourstylesheetnamehere.css" type="text/css" rel="stylesheet">

If not working make sure you did the following:
-Internet browser hard refresh to clear the cached files.
-If using Zen theme check 'Rebuild theme registry on every page.' during development at /admin/build/themes/settings/yourthemenamehere
-Click on 'Clear cached data' button at /admin/settings/performance

 
 

Drupal is a registered trademark of Dries Buytaert.