开发者

drupal 7 link to theme image

开发者 https://www.devze.com 2023-04-11 12:12 出处:网络
This seems like a very basic question, but I have been开发者_开发百科 googling around and can\'t get a good answer.

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消