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">';
}
?>


Comments
Actually, the current official Agaric way
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.]
Include the leading /
If you don't include the leading slash in your image paths, the URL will be wrong for non-home pages, if you don't include the base_path() in the URL.
So,
<img src="/<?php print path_to_theme(); ?>/images/your-image.png" />P.S. your captcha is broken, rejecting on preview.
La la la-la
Faster to use commas than dots when calling 'echo' -- skip the string concat. ;)
MB
Microsoft Office 2010
ost of us who have worked with Windows 8 and Microsoft Windows 8 deployments have probably Office 2007 come across the task of preventing the Microsoft Office 2007 first run Office 2007 Download prompts that users have to deal Office 2007 Professional with when they launch an MS Office 2007 install for the first time. This usually Download Office 2007 that big of a deal in the conventional Microsoft Office 2007 Professional physical desktop to Microsoft Office 2007 Download user environment but when dealing microsoft office 2007 full version with virtual desktops and more specifically, Office 2010 , these annoying prompts Microsoft Office 2010 will continuously prompt the user whenever the Download Office 2010 master image is updated and the users’ desktops are refreshed. windows office 2010 previously blogged about how to remove these prompts via the MS Office 2010 too late for you to create a customization file, you still have the option of using Office 2010 Download to disable them. Office 2010 Professional sure a quick search will reveal Microsoft Office 2010 Download numerous results on how to do this but Microsoft Office 2011 going to write this post anyways so I can quickly reference to it in the future.
Post new comment