I am trying to add an image (small arrow gif icon) which is uploaded to the image directory within my Drupal theme files (root/sites/all/themes/mytheme/images).
The following works at the page.tlp.php level, and it also is working at the field.tlp.php level - but it won't work in node.tlp.php. The node.tlp.php file is working effectively but the image doesn't show! If I paste exactly the same code into the other afore mentioned templates it does show..??
<img src="<?php print base_path() . path_to_theme(); ?>/images/arrow-right.gif" width="20" height="13" alt="Arrow Right">
Any ideas how I should reference an image in a node.tlp.php file?
Thanks!
I'm wondering why not us the $directory variable which is available in node.tpl.php file. It was available in Drupal 6 and seems to be working for me for D7 as well.
So code qould be something like:
Use the GLOBAL variables array. They are always available because they are, well, global. They are available as an array.
I would just create a new variable in template.php to keep your template files clean:
Then in your template file:
Documentation here: http://api.drupal.org/api/drupal/globals/7
Using
drupal_get_path()
instead ofpath_to_theme()
may work, worth a shotThis was suggested Here