Drupal 7 - 将图像添加到node.tlp.php主题文件 [英] Drupal 7 - Adding an image to a node.tlp.php theme file

查看:151
本文介绍了Drupal 7 - 将图像添加到node.tlp.php主题文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试添加一个图像(小箭头gif图标),它被上传到我的Drupal主题文件(root / sites / all / themes / mytheme / images)中的图像目录。

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).

以下工作在page.tlp.php级别,它也在field.tlp.php级别工作,但它不会在node.tlp.php中工作。 node.tlp.php文件正常工作,但图像不显示!如果我将完全相同的代码粘贴到其他上述模板中,它会显示..?

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">

任何想法如何引用node.tlp.php文件中的图像?

Any ideas how I should reference an image in a node.tlp.php file?

谢谢!

推荐答案

使用 drupal_get_path() 而不是< a href =http://api.drupal.org/api/drupal/includes--theme.inc/function/path_to_theme =noreferrer> path_to_theme() 可以工作,值得一提。

Using drupal_get_path() instead of path_to_theme() may work, worth a shot

<img src="<?php print base_path() . drupal_get_path('theme', 'THEMENAME'); ?>/images/arrow-right.gif" width="20" height="13" alt="Arrow Right">

这是建议这里

这篇关于Drupal 7 - 将图像添加到node.tlp.php主题文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆