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

查看:20
本文介绍了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?

谢谢!

推荐答案

Using drupal_get_path() 而不是 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天全站免登陆