Path to theme
Looking for the drupal path to your current theme? It can be helpful if you're making a theme and, for a change, you want to link directly to
print theme('stylesheet_import', base_path() . path_to_theme() ."/modules.css");
For our purposes, something like:
<img src="<?php echo base_path() . path_to_theme() . "/sample.png"; ?>" /> Now I'm not sure that "." in echo will work. Feel free to test it out for us!
UPDATE: To get print an image that is in your theme by getting its path, Agaric thinks the recommended approach is
<?php
print '<img src="'. path_to_theme() .'/images/picture.jpg" />';
?>Or the Dan Hakimzadeh method of using imagecache, and therefore the files directory, from your theme:
<?php
$primaryimagexists = $node->node_data_field_user_picture_field_user_picture_fid;
if ($primaryimagexists != 0) {
print $field_user_picture_fid;
}
else {
print '<img src="/sites/example.com/files/imagecache/userpic_thumb/sites/example.com/files/images/LC-Sun.jpg">';
}
?>
Should look something like this, to call for instance your custom logo, in an
imagesfolder in your theme directory, directly from your theme's page template file (page.tpl.php):<img src="<?php print base_path() . path_to_theme() . "/images/sample.png"; ?>" alt="<?php print t('Home') ?>" id="logo" />[Note: comment older than update above.]