How to refer paths relative to the theme directory? I have a theme called Eternal with the following data in it's eternal.info file-

name = Eternal
description = A Customized Drupal 7 Theme
core = 7.x
engine = phptemplate


In the template folder lies the page.tpl.php. Under the /themes/ folder, the address becomes -

/eternal/templates/page.tpl.php

There are several lines inside the page.tpl.php that require I define a path for an image, like so-

&lt;img src="images/facebook_icon.png" alt="image comes here"&gt;

The /images/ folder is located inside the /eternal/ folder, so to access it from /templates/ one would need to travel one level up and then access the /images/ folder. That would look like this - /../images/.

The problem is, I cannot define a link that works in Drupal. And I'm sure the images exist in that directory.

I've tried these-

&lt;img src="../images/facebook_icon.png" alt="image comes here"&gt;

&lt;img src="images/facebook_icon.png" alt="image comes here"&gt; &lt;!-- not like this would have worked anyway --&gt; 

&lt;img src="&lt;?php drupal_get_path('theme', 'eternal'); ?&gt;/images/facebook_icon.png" alt="image comes here"&gt;

It just shows the alt text in every case. No image. How to accomplish this and what is the recommended and proper way to do this?
&lt;?php print drupal_get_path('theme', 'eternal'); ?&gt;


as you've already tried, is the correct way to solve your problem. Notice though that you have to print it out as well, as drupal_get_path will only return the path, not print it for you.

I can't immediately think of any reason why it would not work in your case. Some potential suggestions to try could be


Double-check your spelling of the theme name in the code.
Clear caches.
Try disabling the theme/module and re-enable it.


Failing everything else, you'll need to debug drupal_get_filename() directly.