User login

How to call the path to theme from within the theme (and why)

We had a site that occasionally generated page not found errors for ie6_fixes.css. Occasionally, we realized, because this file was only sought by browsers following the hide-from-everything-except Internet Explorer 6 code. The file was then not being found because the name of the whole theme had changed, and the existing template had hard-coded in not just the location but also the name of the theme.

Changed in page.tpl.php (and all variations such as page-front.tpl.php and page-node-4.tpl.php:
@import "/sites/default/themes/jonas_theme/ie6_fixes.css";

One should not hard-code, of course, and so:

http://api.drupal.org/api/drupal/includes--theme.inc/function/path_to_theme/6

or the perhaps more reliable

http://api.drupal.org/api/drupal/includes--common.inc/function/drupal_get_path/6

can be used.

This page is superseded by http://data.agaric.com/get-path-drupal-module-or-theme