Finding the path to the current theme

Printer-friendly version

It turns out, path_to_theme() only works correctly when used within a theme's template.php file. When used within a module it returns, system/module.

The following will always return the path to the theme.

  $type = 'theme';
  $name = variable_get('theme_default', NULL);
  $path = drupal_get_path($type, $name);

For more info: http://api.drupal.org/api/function/drupal_get_path/6

Comments

Post new comment

  • Allowed HTML tags: <a> <div> <em> <h1> <h2> <h3> <h4> <h5> <cite> <code> <img> <ul> <ol> <li> <dl> <dt> <dd> <p> <strong> <strike> <table> <tr> <td> <tbody>
  • Lines and paragraphs break automatically.
  • Web page addresses and e-mail addresses turn into links automatically.

More information about formatting options

By submitting this form, you accept the Mollom privacy policy.

Creative Commons License
ronliskey.com is licensed under a Creative Commons License.