2009-10-15

I'm new with drupal, and I wish sobody told me this yesterday: To make an absolute link to an image in a theme, without worrying about where the theme is going to be installed, you can do the following:

<img alt="logo" src="<?php echo(base_path().drupal_get_path('theme','your_theme_name'))?>/img/some_image.png" />

If you are using phptemplate, the drupal_get_path-call might be substituted by just $directory, making it even simpler:

<img alt="logo" src="<?php echo(base_path() . $directory )?>/img/some_image.png" />

The second one was found here:  http://drupal.org/node/52520

No comments:

Post a Comment