In my theme's page.tpl.php, I am using the following to print out my theme path (to call images from the theme directory):

<?php $theme_path = drupal_get_path('theme', variable_get('theme_default', NULL)); ?>
<img src="<?php echo $theme_path; ?>/img/foo.png" /> 

This of course leaves my theme looking in the wrong directory for images and breaks each one as switchtheme leaves the "default theme" intact.

Is there a way to work around this or a better way to call images in my theme that will work with switchtheme?

Comments

gthing’s picture

Status: Active » Closed (fixed)

Ah looks like this works:

<?php print base_path() . path_to_theme(); ?>