drupal 7 link to theme image
This seems like a very basic question, but I have been开发者_开发百科 googling around and can't get a good answer.
given sites/all/themes/phppos/img/demo.png
What is the CORRECT way to create an image take front page--front.tpl.php?
I have tried the below: (I get modules/system/img/demo.png)
<?php echo theme('image', array('path' => path_to_theme() .'/img/demo.png')); ?>
You're getting modules/system/img/demo.png
as the resulting path because you're calling the path_to_theme()
function within the theme()
function.
According to the documentation for path_to_theme()
:
...when invoked within the scope of a theming call it will depend on where the theming function is handled.
Try using drupal_get_path('theme', $theme_name)
instead.
精彩评论